What is SQL Injection?
SQL injection (SQLi) is one of the most common and dangerous web vulnerabilities. It occurs when user input is included directly in a database query without proper sanitization.
How It Works
A normal login query looks like this:
SELECT * FROM users WHERE username='admin' AND password='password123'
If the developer builds this query by concatenating user input:
query = "SELECT * FROM users WHERE username='" + username + "'"
An attacker can input:
admin'--
Which makes the query:
SELECT * FROM users WHERE username='admin'--' AND password='whatever'
The -- comments out the rest, bypassing the password check entirely.
How to Spot It
Signs a site might be vulnerable:
- Error messages containing SQL syntax when you add a quote
- The page behaves differently with ' vs ''
- URLs containing id=1 parameters
Your Task
For this Easy lesson, no exploitation is needed. Simply read and understand the concept above.
The flag for completing this lesson is below.