Originally published in 2013 when this blog covered offensive tutorials; rewritten in 2026 with a defensive focus.
Authorization notice: All security testing must only be done on systems you own or are explicitly authorized to assess. Testing someone else's website without written permission is illegal in most jurisdictions — including the "vulnerable site lists" this post used to contain, which have been removed. If you find a vulnerability on someone else's site, do not exploit it; report it responsibly through the site's contact or bug bounty channel.
Why SQL injection still matters
SQL injection (SQLi) has topped vulnerability lists for over two decades, and it hasn't gone away. Attackers still probe the internet automatically for applications that concatenate user input into database queries. A single injection point can expose customer data, credentials, and entire databases. The good news: the fix is well understood, and it starts with finding the flaws in your own code before attackers find them.
Find injection flaws in your own applications — safely
Never test against live third-party sites. Instead, practice and validate your skills in legal lab environments built for exactly this purpose:
- DVWA (Damn Vulnerable Web Application) — deliberately vulnerable app with adjustable difficulty levels; ideal for learning what SQLi looks like and how defenses stop it.
- bWAPP — a buggy web app with dozens of vulnerabilities including many SQL injection variants.
- WebGoat — OWASP's interactive training app with guided SQL injection lessons and explanations.
Run these in a local VM or container, with the traffic isolated from production networks. For your own production applications, use automated scanners (DAST) and manual code review as part of your SDLC, and run authenticated assessments under a written rules of engagement.
What attacker probing looks like in your logs
Knowing what to look for is half the battle. Injection probes often leave recognizable traces:
- Requests containing SQL syntax fragments or error-triggering characters in parameters that should be plain numbers or names.
- Spikes of database error messages (syntax errors, type-conversion errors) correlated with a single client IP.
- Unusual query timing — blind injection techniques cause measurable delays, so watch for abnormal response-time patterns on database-backed endpoints.
- Exfiltration-style responses: large, unexpected result sets returned to unauthenticated or low-privilege sessions.
Feed these signals into your SIEM and alert on them — database error-rate anomalies per endpoint are one of the most reliable early warnings.
Fix and harden: the remediation playbook
- Parameterized queries (prepared statements) are the primary defense. Never build SQL by concatenating user input — pass values as parameters so the database treats them as data, not code.
- Least privilege for database accounts. Your application's DB user should not be able to drop tables or read unrelated schemas. If injection happens anyway, limited privileges contain the blast radius.
- Input validation and allow-listing as a complementary layer — validate types, lengths, and formats on the server side.
- Error handling: return generic errors to users; log the details server-side. Verbose database errors help attackers map your schema.
- WAF rules (Web Application Firewall) as defense in depth — block known injection patterns at the edge, but never treat the WAF as a substitute for fixing the code.
- Patch and scan continuously: keep frameworks and drivers updated, and re-scan after every release.
Bottom line
The vulnerable-site list this post once carried is gone, and good riddance. The defensive path is more valuable: learn injection in legal labs, instrument your logging to catch probes, and eliminate the flaw at the source with parameterized queries and least privilege. That's how you win against SQL injection — by making your own applications a dead end for it.
