Web Hacking/DreamHack

[🐱Wargame] Dreamhack- simple-ssti

hanbunny 2025. 3. 4. 18:42

404Error 페이지와 robots.txt 페이지가 있는 화면이 뜨고 시작한다.
소스코드 열어봄.

 

#!/usr/bin/python3
from flask import Flask, request, render_template, render_template_string, make_response, redirect, url_for
import socket

app = Flask(__name__)

try:
    FLAG = open('./flag.txt', 'r').read()
except:
    FLAG = '[**FLAG**]'

app.secret_key = FLAG


@app.route('/')
def index():
    return render_template('index.html')

@app.errorhandler(404)
def Error404(e):
    template = '''
    <div class="center">
        <h1>Page Not Found.</h1>
        <h3>%s</h3>
    </div>
''' % (request.path)
    return render_template_string(template), 404

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

404Error 페이지와 robots.txt 페이지를 들어가보니 요청한 경로가 화면에 출력되는걸 보고 경로부분에 구문을 넣어 코드가 단순 출력되는지 실행되고 있는지 확인해봄.

경로에 {{7*7}}을 넣었더니 49가 뜸.
그래서 가장 기본적인 구문인 {{config.items()}}을 넣어봤더니