본문 바로가기

ETC/EVI$ION

EVI$ION 정규 세션 과제 - #7

# blind-command

https://dreamhack.io/wargame/challenges/73

 

blind-command

Read the flag file XD Reference Web Hacking

dreamhack.io

 

 

 

#!/usr/bin/env python3
from flask import Flask, request
import os

app = Flask(__name__)

@app.route('/' , methods=['GET'])
def index():
    cmd = request.args.get('cmd', '')
    if not cmd:
        return "?cmd=[cmd]"

    if request.method == 'GET':
        ''
    else:
        os.system(cmd)
    return cmd

app.run(host='0.0.0.0', port=8000)

 

- cmd 인자에 [cmd] 값을 입력받는다.

- request.method가 GET이 아니면 os.system()으로 인자를 실행한다.

 

os.system()으로 명령어를 실행시키려면 GET 방식이 아니여야한다.

따라서 HEAD 방식으로 데이터를 보내야한다.

 

burp suite로 request 내용을 수정해보자

 

그리고 request bin 기능을 사용해 명령어 실행 결과를 확인해보자

 

 

플래그가 출력되었당

 

'ETC > EVI$ION' 카테고리의 다른 글

EVI$ION 7기 정규 세션 과제 - #2  (0) 2024.09.26
EVI$ION 7기 정규 세션 과제 - #1  (1) 2024.09.18
EVI$ION 정규 세션 과제 - #6  (0) 2024.05.23
EVI$ION 정규 세션 과제 - #5  (0) 2024.05.16
EVI$ION 러닝 세션 과제 - #4 (5/11)  (0) 2024.05.11