OverTheWire/Bandit
Bandit26
hanhxx
2022. 12. 24. 00:01
Overthewire - Bandit level 26
Connection : bandit26@bandit.labs.overthewire.org -p 2220
username : bandit26
Bandit level26 ) 이번 문제는 딱히 설명은 없고 얼른 bandit27의 passwd를 잡아내라고 한다.
Kali linux - Terminal
저번 level에 얻은 쉘로 풀어보자.
directory에는 text.txt 말고 bandit27-do라는 파일이 있어서 file command로 어떤 유형의 파일인지 확인해 보았다.
보자 하니 이 파일은 setuid가 설정되어있는 듯하다.
그렇다면 이전 level 중에서 setuid file을 실행시키는 동시에 명령어를 입력한 적이 있었는 데,
이번에도 같은 방식을 사용해 보자.
./bandit27-do cat /etc/bandit_pass/bandit27
setuid file을 실행시키는 순간만큼은 root 권한이 되기 때문에,
cat command로 다음 level의 passwd를 읽으면 된다.
예상한 대로 passwd가 잘 출력되는 것을 볼 수 있다.