728x90
문제 정보
File Download 취약점이 존재하는 웹 서비스입니다.
flag.py를 다운로드 받으면 플래그를 획득할 수 있습니다.
Upload My Memo 메뉴에 들어가서 글을 쓰고 올리면 / 페이지에 출력된다. 글을 클릭하면 read_memo 함수가 실행된다.
read 함수의 name인자에 제목을 넣으면 해당 제목의 글을 읽는다.
UPLOAD_DIR = 'uploads'
@APP.route('/read')
def read_memo():
error = False
data = b''
filename = request.args.get('name', '')
try:
with open(f'{UPLOAD_DIR}/{filename}', 'rb') as f:
data = f.read()
except (IsADirectoryError, FileNotFoundError):
error = True
return render_template('read.html',
filename=filename,
content=data.decode('utf-8'),
error=error)
uploads 디렉토리 밑에 filename이 위치한다.
name 인자에 flag.py를 입력하니 없다고 한다.
../flag.py를 입력하니 답이 나온다. uploads 디렉토리와 같은 경로에 flag.py가 존재했다.
FLAG = 'DH{uploading_webshell_in_python_program_is_my_dream}'
728x90
'dreamhack > Web Hacking' 카테고리의 다른 글
pathtraversal (0) | 2023.02.11 |
---|---|
session-basic (0) | 2023.02.09 |
XSS-1 (0) | 2023.02.07 |
simple_sqli (0) | 2023.02.07 |
cookie (0) | 2023.02.07 |