SQL injection (SQLi)¶

SQL injection (SQLi) is a web security vulnerability that allows an attacker to interfere with the queries that an application makes to its database. It generally allows an attacker to view data that they are not normally able to retrieve.
SQLi is still a significant threat, but its prevalence has evolved thanks to the widespread use of ORMs (Django, Hibernate, Entity Framework), prepared statements becoming the default in modern frameworks, and security tooling (SAST/DAST) catching basic SQLi early.
But it is not dead. It still appears in legacy systems (old PHP, ASP.NET apps), APIs with raw SQL queries (e.g., poorly coded microservices), “Fast-moving” dev teams skipping security reviews, admin panels & internal tools (often neglected in security testing).
It is worth testing for SQLi because of the high impact when found as it can lead to full database takeover, RCE (e.g., via xp_cmdshell in MSSQL), and authentication bypasses. Also, new attack vectors have emerged. NoSQLi (MongoDB, CouchDB) is rising, but classic SQLi still exists, and the appearance of second-order SQLi (stored payloads triggering later).
Prioritize after XSS/SSRF, but before XXE/SSTI.
Test for it in legacy apps, APIs with raw SQL, and login/search functions:
- SQL injection vulnerability in WHERE clause allowing retrieval of hidden data
- SQL injection vulnerability allowing login bypass
- SQL injection UNION attack, determining the number of columns returned by the query
- SQL injection UNION attack, finding a column containing text
- SQL injection UNION attack, retrieving data from other tables
- SQL injection UNION attack, retrieving multiple values in a single column
- SQL injection attack, querying the database type and version on Oracle
- SQL injection attack, querying the database type and version on MySQL and Microsoft
- SQL injection attack, listing the database contents on non-Oracle databases
- SQL injection attack, listing the database contents on Oracle
- Blind SQL injection with conditional responses
- Blind SQL injection with conditional errors
- Blind SQL injection with time delays
- Blind SQL injection with time delays and information retrieval
- Blind SQL injection with out-of-band interaction
- Blind SQL injection with out-of-band data exfiltration
- SQL injection with filter bypass via XML encoding