Skip to content

Latest commit

 

History

History
38 lines (24 loc) · 2.27 KB

211021.md

File metadata and controls

38 lines (24 loc) · 2.27 KB

Day 20

OverTheWire WriteUp

Level30 -> Level31

Level Goal

There is a git repository at ssh://bandit30-git@localhost/home/bandit30-git/repo. The password for the user bandit30-git is the same as for the user bandit30.

Clone the repository and find the password for the next level.

이건 이번에 처음 알게된 것이다. log, branch를 확인해 봤지만 아무 것도 없어서 .git 디렉토리를 보고 있었는데 packed-ref라는 것이 있었다.

이걸 cat으로 봐보니까 commit과 똑같은 형식을 한 문자열들이 있었다. 이걸 git show로 띄워보니까 password를 알 수 있었다.

풀고 나서 추가로 알게 된 것

  • git show-ref를 하면 ref를 볼 수 있다.
  • reference는 branch와 비슷하지만, branch는 논리적 명칭, reference는 파일 구조상의 명칭이라고 함

Level31 -> Level32

Level Goal

There is a git repository at ssh://bandit31-git@localhost/home/bandit31-git/repo. The password for the user bandit31-git is the same as for the user bandit31.

Clone the repository and find the password for the next level.

이번에는 readme에 파일명은 key.txt, 내용은 'May I come in?', master branch에 push를 하면 password를 얻을 수 있다고 적혀있다.

그래서 일단 vi로 저 파일을 만들고 git add ./key.txt로 add를 하려는데 .gitignore 때문에 할 수 없다고 나왔다. 그래서 .gitignore 파일에서 *.txt부분을 지우고 다시 add, commit, push를 하니까 password를 얻을 수 있었다.

Level32 -> Level33

After all this git stuff its time for another escape. Good luck!

이번에는 쉘에서 문자를 입력하면 그것을 대문자로 바꿔버려서 명령어를 사용할 수가 없다.

이전에 쉘 스크립트와 관련된 문제를 풀 때 position parameter라는 것을 본적이 있다.

$0에는 쉘이름, 커맨드, $1에는 첫 번째 parameter 이런식으로 들어간다는 것을 봤었다.

이번 문제에서 요구하는 것과 일치하여 $0을 입력해 봤더니 sh 쉘이 실행되었다. 그 다음에는 cat /etc/bandit_pass/bandit33을 입력해주면 끝

이걸로 OverTheWire의 Wargame이 끝났다. 어거지로 풀린 것들이 몇개 있긴 했지만 푸는 과정에서 여러가지를 찾아보는 것이 유익했던 것 같다.