Post

Bandit Level 30 → Level 31

문제

https://overthewire.org/wargames/bandit/bandit31.html

목표

다음 레벨의 패스워드를 찾는다.

ssh://bandit30-git@localhost/home/bandit30-git/repo 2220번 포트에 git 저장소가 있다. bandit30-git의 비밀번호는 bandit30의 비밀번호와 동일하다.

풀이

권한이 없으니 새 디렉토리로 이동한다.

1
2
bandit30@bandit:~$ mkdir /tmp/new_dir
bandit30@bandit:~$ cd /tmp/new_dir


git clone 명령어로 git 저장소를 복제한다.

1
bandit30@bandit:/tmp/new_dir$ git clone ssh://bandit30-git@localhost:2220/home/bandit30-git/repo


README.md 파일을 확인해보니 그냥 빈 파일이라고 한다.

1
2
3
4
5
6
7
bandit30@bandit:/tmp/new_dir$ ls
repo
bandit30@bandit:/tmp/new_dir$ cd repo
bandit30@bandit:/tmp/new_dir/repo$ ls
README.md
bandit30@bandit:/tmp/new_dir/repo$ cat README.md
just an epmty file... muahaha


git show-ref 명령어로 저장소의 레퍼런스들을 확인해보니 secret 태그가 보인다.

1
2
3
4
5
bandit30@bandit:/tmp/new_dir/repo$ git show-ref
d39631d73f786269b895ae9a7b14760cbf40a99f refs/heads/master
d39631d73f786269b895ae9a7b14760cbf40a99f refs/remotes/origin/HEAD
d39631d73f786269b895ae9a7b14760cbf40a99f refs/remotes/origin/master
831aac2e2341f009e40e46392a4f5dd318483019 refs/tags/secret


secret 태그를 확인해보니 패스워드가 출력되었다.

1
2
bandit30@bandit:/tmp/new_dir/repo$ git show 831aac2e2341f009e40e46392a4f5dd318483019
OoffzGDlzhAlerFJ2cAiz1D41JW1Mhmt


Password : OoffzGDlzhAlerFJ2cAiz1D41JW1Mhmt

배운 것

  • git show-ref 명령어로 저장소의 레퍼런스들을 확인할 수 있다.
This post is licensed under CC BY 4.0 by the author.