SQL Injection
Cheat sheet · https://pcornel.dk/topic.php?topic=4756
Answer
SQL injection inserts SQL through user input to read, change or delete database data. Parameterized queries or prepared statements prevent it; escaping alone is not enough.
Remember
- Use prepared statements.
- Escaping alone is not enough.
- Use least-privilege database accounts.
First checks
sqlmap -u '<url>?id=1' --batch --level=1 (authorised test only)— detect SQLi- Code review: parameterised queries — prepared statements
- DB account privileges — least privilege
Verify in this order
input → parameter binding → query (no injection)
Where it usually breaks
First mismatch in asset/subject identity → trust/authentication → authorization/policy → enforcement/control → telemetry/detection → protected outcome/response; preserve identity/policy/pre-state before mutation.
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=4756