WEB hacking/PortSwigger

Lab: SQL injection vulnerability in WHERE clause allowing retrieval of hidden data

Roronoa 2023. 5. 22. 02:48
반응형

This lab contains a SQL injection vulnerability in the product category filter. When the user selects a category, the application carries out a SQL query like the following

SELECT * FROM products WHERE category = 'Gifts' AND released = 1

To solve the lab, perform a SQL injection attack that causes the application to display details of all products in any category, both released and unreleased.

 

[image 1] web site

This is a picture of a shopping mall.

Let's click on the Pets category.

 

[image 2] Click pets category

If category=Pets, 3 pictures are displayed.

 

[image 3] case with category=Pets'--

But if category=Pets'--, 4 pictures are displayed.

--(주석)으로 인해 released = 1 부분이 수행되지 않으므로 출시되지 않은 Pets의 카테고리도 출력된다.

하지만 우리는 모든 제품을 다 출력해야하기 때문에 아래와 같이 입력하면 문제를 해결할 수 있다.

category=Pets' or 1=1--

카테고리가 Pets이거나 1=1인 참인경우를 출력하니깐 모든 경우를 출력한다.

해당 페이로드를 입력해보자!!

 

[image 4] problem solving

문제를 해결하였다.

반응형