Overview:
In this lab, we exploit a basic SQL injection vulnerability to retrieve hidden data from the database. The goal is to understand how attackers manipulate SQL queries and the importance of validating and sanitizing user inputs.
Steps:
Start the Lab — Launch the lab in PortSwigger.
Identify Vulnerable Input — Locate the input field vulnerable to SQL Injection.
Craft Injection Payload — Inject SQL payload to manipulate the query and reveal hidden data (example: ' OR 1=1 --).
Observe the Results — Retrieve and display hidden data from the database.
Understand Defenses — Review methods to prevent SQL Injection, including:
Using prepared statements (parameterized queries)
Employing input validation and sanitization
Implementing proper error handling
Threat, Attack & Defense Mapping:
Threat: Unauthorized access to sensitive database information
Attack: SQL Injection via crafted input
Defense Mechanisms: Input validation, prepared statements, error handling
Screenshots
Through this lab, we demonstrated how an attacker can exploit SQL Injection vulnerabilities to access hidden data. This highlights the critical need for secure coding practices such as using parameterized queries and thorough input validation to protect applications from such attacks.