Level Goal
The credentials for the next level can be retrieved by submitting the password of the current level to a port on localhost in the range 31000 to 32000. First find out which of these ports have a server listening on them. Then find out which of those speak SSL and which don’t. There is only 1 server that will give the next credentials, the others will simply send back to you whatever you send to it.
Commands you may need to solve this level
ssh, telnet, nc, openssl, s_client, nmap
다음 레벨로 가는 패스워드는 localhost
의 31000
에서 32000
번 사이에 있는 특정 포트에 현재 레벨의 패스워드를 제출하면 얻을 수 있다. 먼저 서버에서 listening 중인 포트가 어떤 것들이 있는지 확인하고, SSL
통신을 하는 포트와 평문 통신을 하는 포트를 구분해야 한다. 단 1개의 서버만 다음 레벨로 가는 패스워드를 제공한다.
nmap -p 31000-32000 localhost
일단 nmap
을 사용하여 localhost
에 31000
에서 32000
번 중 어떤 포트가 열려 있는지 확인한다.
openssl s_client -connect localhost:31790
mkdir /tmp/bandityj
cat > /tmp/bandityj/key
[복사한 private key 값]
열려 있는 포트 중 31790
번 포트로 접속하여 현재 레벨의 패스워드를 제출하면 private key 값을 얻을 수 있다. 해당 키 값을 /tmp
디렉토리 아래에 새 디렉토리를 생성하여 key 값을 저장할 파일을 생성한다.
cd /tmp/bandityj
ssh -i ./key bandit17@localhost
그 후 ssh
명령어를 사용하여 bandit17
로 로그인을 시도한다. 하지만 Permissions 0644 for './key' are too open.
이라는 경고 메세지와 함께 패스워드를 입력하라고 나오는데, key 파일의 퍼미션을 변경한다.
chmod 700 ./key
ssh -i ./key bandit17@localhost
cat /etc/bandit_pass/bandit17
퍼미션을 변경한 후에 다시 ssh
명령어를 사용하면 성공적으로 접속하게 된다. 그 후 bandit17
의 패스워드를 획득할 수 있다.
- nmap
네트워크 탐색과 보안감사를 하는 오픈소스 툴로, 주로 특정 호스트의 포트 스캔을 할 때 사용한다.