[Dreamhack] WebHacking Session-basic 문제풀이

hee·2025년 4월 7일

Web hacking

목록 보기
8/11

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

  1. 문제 파일 다운로드 후 서버 생성하고 VM에 접속함

  2. admin 계정에 로그인하기 위해 cookie 문제와 동일하게 시도

    변화 없음

index 페이지 코드

@app.route('/') # / 페이지 라우팅 
def index():
    session_id = request.cookies.get('sessionid', None) # 쿠키에서 sessionid 조회
    try:
        username = session_storage[session_id] # session_storage에서 해당 sessionid를 통해 username 조회
    except KeyError:
        return render_template('index.html')

    return render_template('index.html', text=f'Hello {username}, {"flag is " + FLAG if username == "admin" else "you are not admin"}') 

를 확인해보면 sessionid의 값을 통해 session_storage에서 해당 sessionidusername을 조회해 admin인지 확인하고 있음.
따라서, adminsessionid를 알아야함.

  1. admin의 sessionid값을 알기 위해 url+/admin 접속

  2. guest로 로그인 진행

  1. guest의 sessionid 변조 진행

0개의 댓글