There is a setuid binary in the homedirectory that does the following: it makes a connection to localhost on the port you specify as a commandline argument. It then reads a line of text from the connection and compares it to the password in the previous level (bandit20). If the password is correct, it will transmit the password for the next level (bandit21).
hint : ssh, nc, cat, bash, screen, tmux, Unix ‘job control’ (bg, fg, jobs, &, CTRL-Z, …)
오늘 사용할 명령어
- nc
- setuid
원래는 screen이나 tmux명령어를 사용하면 더욱 좋을텐데 일단 저는 오늘 터미널창 2개 띄워서 한 번 풀어보겠습니다
포트 번호는 nmap으로 포트 스캔했을 때 없는 포트번호 중에 하나 랜덤으로 쓴겁니다
[첫 번째 터미널]
bandit20@bandit:~$ nc -l -p 1116
[두 번째 터미널]
bandit20@bandit:~$ ./suconnect 1116
nc 명령어가 하는 일은 서버가 일을 하고 있다면 데이터를 전송하고 수령할 수 있는 친구였죠?
그래서 첫 번째 터미널 창에 비밀번호를 보내봤습니다
[첫 번째 터미널]
bandit20@bandit:~$ nc -l -p 1116
0qXahG8ZjOVMN9Ghs7iOWsCfZyXOUbYO <-bandit20 password
EeoULMCra2q0dSkYj561DX7s1CpBuOBt <-bandit21 password
[두 번째 터미널]
bandit20@bandit:~$ ./suconnect 1116
Read: 0qXahG8ZjOVMN9Ghs7iOWsCfZyXOUbYO <- 제가 전송한 데이터
Password matches, sending next password <- 데이터 전송해줬다네요
이렇게 비밀번호를 찾았습니당
'bandit' 카테고리의 다른 글
| [OverTheWire] bandit 15 -> 16 (0) | 2025.11.23 |
|---|---|
| [OverTheWire] bandit 14 -> 15 (0) | 2025.11.23 |
| [OverTheWire] bandit 13 -> 14 (0) | 2025.11.23 |
| [OverTheWire] bandit 19 -> 20 (0) | 2025.11.22 |
| [OverTheWire] bandit 12 -> 13 (0) | 2025.11.22 |