All vulnerabilities
CRITICALAppSecexploited in the wild

APPSEC-SQLI

Web app · SQL Injection

Summary

SQL injection occurs when untrusted user input is concatenated directly into a SQL statement so attacker-supplied characters break out of the intended data context and are parsed as SQL syntax; for example string-building a query like SELECT * FROM users WHERE id='" + input + "' lets input such as ' OR '1'='1 or '; DROP TABLE-- alter the query's logic, dump arbitrary tables via UNION SELECT, or chain to OS access through database stored procedures. It maps to OWASP A03:2021 Injection (CWE-89). In the October 2015 TalkTalk breach, attackers used SQLMap against three unpatched legacy Tiscali web pages to exfiltrate personal data of 156,959 customers, including 15,656 bank account numbers and sort codes, drawing a then-record GBP 400,000 ICO fine. The 2008 Heartland Payment Systems breach also began with SQL injection and exposed roughly 130 million payment cards, and CVE-2023-34362 in MOVEit Transfer (2023) was a mass-exploited SQL injection used by the Cl0p group.

How to avoid it in your code

  • Use parameterized queries / prepared statements so input is bound as data, never concatenated into SQL.
  • Use an ORM or query builder that parameterizes by default; never build SQL with string concatenation.
  • Run the application's DB user with least privilege (no DDL, no admin, scoped tables).
  • Validate and allowlist any input used for identifiers, ORDER BY columns, or LIMIT values.
  • Disable verbose database error messages and dangerous stored procedures like xp_cmdshell.

References

Related vulnerabilities

All AppSec →