문제

Write-Up
해당 문제로 접속할 경우 접속할 URL 정보와 문제 파일이 존재한다. 또한, 주어진 URL로 접속하면 다음과 같이 간단하게 Session, Home, login 등과 같은 기본적인 기능만 존재한다.

URL내에서는 default user 값이 guest/guest 인 것 말고는 별다른 정보를 찾지 못해 제공된 파일을 살펴보았다.
제공된 파일은 플라스크 기반으로 작성된 app.py
로 main()
부분은 다음과 같이 구성되어 있으며 서버를 동작시키는 코드와 admin 계정의 sessionid를 생성하는 코드이다.
if __name__ == '__main__':
import os
# create admin sessionid and save it to our storage
# and also you cannot reveal admin's sesseionid by brute forcing!!! haha
session_storage[os.urandom(32).hex()] = 'admin'
print(session_storage)
app.run(host='0.0.0.0', port=포트)
main()
함수 위에 /admin
페이지로 리다이렉션시키는 코드가 존재하는데 admin()
의 리턴값이 session_storage
이므로 주어진 URL에 접속한 후 /admin
페이지로 리다이렉션하면 Flag를 획득할 수 있다.
@app.route('/admin')
def admin():
# developer's note: review below commented code and uncomment it (TODO)
#session_id = request.cookies.get('sessionid', None)
#username = session_storage[session_id]
#if username != 'admin':
# return render_template('index.html')
return session_storage
/admin
페이지로 리다이렉션하면 admin의 sessionid 값을 얻을 수 있고 Application 창에서 admin의 sessionid 값을 생성한 후 새로고침하면 Flag를 획득할 수 있다.

Flag
DH{8f3d86d1134c26fedf7c4c3ecd563aae3da98d5c}
오류, 잘못된 점 또는 궁금한 점이 있으시다면 댓글 남겨주세요❗
Uploaded by N2T
'Dreamhack > Web hacking' 카테고리의 다른 글
ClientSide: XSS 🧑🏻💻 (0) | 2023.01.18 |
---|---|
[Web hacking] Mitigation: Same Origin Policy (0) | 2023.01.18 |
Background: Cookie & Session (0) | 2023.01.17 |
[Web hacking] funjs Write-Up (0) | 2023.01.17 |
[Web hacking] Carve Party Write-up (0) | 2023.01.14 |