壓倒
Ye0L
壓倒
Total
Home
Today
  • ByO (59)
    • 악성코드분석🍳 (10)
      • Android (2)
      • Windows (8)
    • 백준⌨ (1)
    • 개발💻 (14)
      • Python (14)
      • C (0)
    • AI (2)
      • ML (2)
      • DL (0)
    • Dreamhack (23)
      • Web hacking (20)
      • Reversing (3)
    • CTF (5)
      • Forensic (5)
    • Study (4)
      • Linux (2)
      • Web (2)

블로그 메뉴

  • 홈
  • 방명록
  • 깃허브😀
  • 티스토리 홈

공지사항

인기 글

태그

  • APK 구조
  • Raccoon Stealer v2
  • selenium
  • PYTHON
  • [DigitalForensic]with CTF
  • Background: Cookie & Session
  • 크롤링
  • Raccoon Stealer
  • ClientSide: XSS
  • 드림핵
  • web hacking
  • 리버싱
  • 악성코드분석
  • CSRF
  • File Download Vulnerability
  • dreamhack
  • Background:Web Browser
  • reversing
  • forensic
  • Crawling

최근 댓글

최근 글

티스토리

hELLO · Designed By 정상우.
壓倒

Ye0L

Dreamhack/Web hacking

session-basic Write-Up

2023. 1. 17. 20:29

문제


session-basic(출처 : dreamhack)

Write-Up


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

주어진 URL

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

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
    'Dreamhack/Web hacking' 카테고리의 다른 글
    • ClientSide: XSS 🧑🏻‍💻
    • [Web hacking] Mitigation: Same Origin Policy
    • Background: Cookie & Session
    • [Web hacking] funjs Write-Up
    壓倒
    壓倒
    악성코드 분석, 개발, 백준 등 나의 일지

    티스토리툴바