Post

Bandit Level 19 → Level 20

문제

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

목표

/etc/bandit_pass에 위치한 패스워드를 찾는다.

홈 디렉토리에 위치한 setuid 바이너리를 사용해 다음 레벨에 접근할 수 있다.

관련 자료

setuid

풀이

1
2
bandit19@bandit:~$ ls
bandit20-do

홈 디렉토리에 bandit20-do라는 파일이 있는 것을 확인할 수 있다.


파일을 실행해보니 이름 그대로 bandit20의 권한으로 명령할 수 있는 것 같다.

1
2
3
bandit19@bandit:~$ ./bandit20-do
Run a command as another user.
  Example: ./bandit20-do id


이를 이용해 bandit20의 패스워드를 확인한다.

1
2
bandit19@bandit:~$ ./bandit20-do cat /etc/bandit_pass/bandit20
VxCazJaVykI6W36BkBU0mJTCM8rR95XT


Password : VxCazJaVykI6W36BkBU0mJTCM8rR95XT

배운 것

  • setuid를 이용해 권한을 사용할 수 있다.
This post is licensed under CC BY 4.0 by the author.