pathtraversal

minii_
|2023. 11. 9. 03:11
반응형

소스코드에서 userid 정보를 확인할 수 있다. 

문제에서 flag값은 /api/flag에 있다고 알려줬고

서버에 guest와 admin을 입력하면 burf suite에 출력되는 userid이 0,1로 변경되는 것을 확인할 수 있었다.

따라서 ../flag로 값을 변경했더니 flag값이 출력되었다.

 

@app.route('/get_info', methods=['GET', 'POST'])
def get_info():
    if request.method == 'GET':
        return render_template('get_info.html')
    elif request.method == 'POST':
        userid = request.form.get('userid', '')
        info = requests.get(f'{API_HOST}/api/user/{userid}').text
        return render_template('get_info.html', info=info)

소스코드를 더 살펴봤다.

Get 방식으로 /get_info에 접속하면 get_info.html을 보여준다.

POST 방식으로 userid를 보내면 /api/user/{userid}를 요청한다.

userid에 ../flag를 넣으면 /api/user/../flag를 요청한 것이다. 이것은 /api/flag를 요청한 것과 같다.

따라서 Flag를 받아 출력할 수 있는 것이다.

반응형

'Dreamhack > Web' 카테고리의 다른 글

Type c-j  (0) 2023.11.09
session-basic  (0) 2023.11.09
phpreg  (0) 2023.11.09
xss-1  (0) 2023.11.08
Carve Party  (0) 2023.11.03