Level 20 → Level 21

옥영진·2020년 5월 19일
0

Bandit - OverTheWire

목록 보기
21/33

Level 20 → Level 21

목표

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 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).

NOTE: Try connecting to your own network daemon to see if it works as you think

Commands you may need to solve this level
ssh, nc, cat, bash, screen, tmux, Unix ‘job control’ (bg, fg, jobs, &, CTRL-Z, …)

홈 디렉토리에 setuid 권한이 설정된 파일이 있는데 이 파일을 실행하면 인자로 주어진 포트를 이용하여 localhost로 접속할 수 있다. 이후 텍스트 한 줄을 읽어 bandit20 레벨의 패스워드와 비교하여 같으면 다음 레벨(bandit21)로 가는 패스워드를 전송해준다.

해결

./suconnect

일단 setuid 권한이 설정된 파일을 실행해보았다. ./suconnect [포트번호]라고 사용방법이 출력되었고, TCP를 사용하여 localhost의 주어진 포트에 연결하여 정확한 패스워드를 입력받으면 다음 패스워드를 전송한다고 프로그램 설명이 나와있다.

nc -l -p 33000

nc -l 명령어로 localhost의 특정 포트를 listening 상태로 만든다.(터미널1)

./suconnect 33000

새로운 터미널을 만들어 프로그램을 실행하여 열어둔 포트로 접속한다.(터미널2)
다시 터미널1로 가서 bandit20 패스워드를 입력하면 다음 레벨로 갈 수 있는 패스워드를 얻을 수 있다.

  • 데몬(daemon)
    특정 서비스를 위해 백그라운드 상태에서 계속 실행되는 서버 프로세스로, 일련의 명령이 끝나면 종료되는 일반 프로세스와 달리 메모리 상에 계속 상주하고 있는 프로세스를 말한다.
profile
안녕하세요 함께 공부합시다

0개의 댓글