writeup/Bandit

Bandit Level 20 -> Level 23

tnvori 2025. 3. 13. 17:32

그동안 풀어둔 것들 좀 기록하려고 한다.

 

 

Level 19 → Level 20

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

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal To gain access to the next level, you should use the setuid binary in the homedirectory. Execute it without arguments to find out how to use it. Th

overthewire.org

 

setuid 바이너리를 활용하여 /etc/bandit_pass에서 패스워드를 찾아야 한다.

bandit20-do에 s 비트가 존재하는데, 이는 setuid가 활성화되어있음을 의미한다. 다른 사용자가 이를 실행하더라도 bandit20의 권한으로 실행된다.

 

 

 

Level 20 → Level 21

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

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal 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

overthewire.org

이번 문제는 저번 것과 같이 setuid 바이너리를 이용해야 한다.

포트를 열어 level 20의 패스워드를 보내고, 주어진 파일로 해당 포트에 연결하면 이번 패스워드를 획득할 수 있다.

 

 

Level 21 -> Level 22

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

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in /etc/cron.d/ for the configuration and see

overthewire.org

cron과 관련한 문제이다. cron은 시간을 설정해서 프로그램을 실행할 수 있는 서비스이다.

 

cronjob_bandit22를 확인한다.

 

매분마다 cronjob_bandit22.sh를 실행하고 있다.

 

cronjob_bandit22.sh는 패스워드를 /tmp에 저장하는 파일이었고, 해당 파일에서 패스워드를 확인할 수 있다.

 

 

Level 22 → Level 23

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

 

OverTheWire: Level Goal

We're hackers, and we are good-looking. We are the 1%. <!-- Please read and accept the Rules! --> Level Goal A program is running automatically at regular intervals from cron, the time-based job scheduler. Look in /etc/cron.d/ for the configuration and see

overthewire.org

이전 문제처럼 cron을 활용한다.

 

cronjob_bandit23.sh를 실행하여 대상 사용자의 패스워드를 출력할 수 있어 보인다.

 

mytarget=$(echo I am user $myname | md5sum | cut -d ' ' -f 1)

이 부분에서 사용자명을 해시함수를 통해 해시값으로 변경하고 mytarget에 저장한다.

이를 실행하여 bandit23의 패스워드가 저장될 위치를 알 수 있다.

 

'writeup > Bandit' 카테고리의 다른 글

Bandit Level 17 -> Level 19  (0) 2025.03.04
Bandit Level 14 -> Level 17  (0) 2025.02.27
Bandit Level 12 -> Level 14  (0) 2025.02.25
Bandit Level 9 -> Level 12  (0) 2025.02.11
Bandit Level 5 -> Level 8  (0) 2025.02.09