There is a git repository at ssh://bandit28-git@localhost/home/bandit28-git/repo via the port 2220. The password for the user bandit28-git is the same as for the user bandit28.
이번에도 이전 레벨의 문제와 동일하네요.
git repo를 clone해와서 상황을 봐야할 것 같습니다.
/tmp 폴더로 이동한 후 임시 폴더(bandit29_pass)를 생성하여 git repo를 복제하도록 하겠습니다.
bandit28@bandit:~$ cd /tmp
bandit28@bandit:/tmp$ mkdir bandit29_pass
bandit28@bandit:/tmp$ cd bandit29_pass
bandit28@bandit:/tmp/bandit29_pass$
bandit28@bandit:/tmp/bandit29_pass$ git clone ssh://bandit28-git@localhost:2220/home/bandit28-git/repo
복제된 repo 폴더에 README.md라는 파일이 있군요!
cat 명령어로 읽어보겠습니다.
bandit28@bandit:/tmp/bandit29_pass/repo$ ls -l
total 4
-rw-rw-r-- 1 bandit28 bandit28 111 Mar 24 11:26 README.md
bandit28@bandit:/tmp/bandit29_pass/repo$ cat README.md
# Bandit Notes
Some notes for level29 of bandit.
## credentials
- username: bandit29
- password: xxxxxxxxxx
비밀번호가 xxx로 표시되어 있네요.
이번 단계에서는 git repository의 히스토리를 살펴봐야 합니다.
왜냐하면 현재 xxx로 표시된 비밀번호가 과거에는 진짜 비밀번호였다가 수정되었을 가능성이 있거든요!
히스토리를 보기 위해서 git log를 사용하면 됩니다.
📌 git log
git 저장소의 commit 내역(변경 이력)을 보여주는 명령어입니다.
지금까지 수행된 commit의 기록들이 시간순으로 나오지요.
아래는 commit 기록들이 나와있는데요!
맨 아래 부분이 최초의 README.md 파일이구요!
처음 파일이 비밀번호 유출로 인해 수정된 commit입니다.
뭔가 두번째 commit이 비밀번호가 포함된 파일 같군요!
bandit28@bandit:/tmp/bandit29_pass/repo$ git log
commit 817e303aa6c2b207ea043c7bba1bb7575dc4ea73 (HEAD, origin/master, origin/HEAD, master)
Author: Morla Porla <morla@overthewire.org>
Date: Thu Sep 19 07:08:39 2024 +0000
fix info leak
commit 3621de89d8eac9d3b64302bfb2dc67e9a566decd
Author: Morla Porla <morla@overthewire.org>
Date: Thu Sep 19 07:08:39 2024 +0000
add missing data
commit 0622b73250502618babac3d174724bb303c32182
Author: Ben Dover <noone@overthewire.org>
Date: Thu Sep 19 07:08:39 2024 +0000
initial commit of README.md
git checkout을 사용하면 원하는 시점의 commit으로 이동할 수 있습니다.
bandit28@bandit:/tmp/bandit29_pass/repo$ cat README.md
# Bandit Notes
Some notes for level29 of bandit.
## credentials
- username: bandit29
- password: 4pT1t5DENaYuqnqvadYs1oE4QLCdjmJ7
예상대로 비밀번호가 포함된 파일입니다 :)