SQL Injection
SQL injection is a type of attack where an attacker inserts malicious SQL code into input fields or parameters that an application passes to its database. This can allow the attacker to read, modify, or delete data the application stores. It is a vulnerability that arises when an application fails to properly separate user-supplied input from database query logic.
SQL injection (SQLi) is a code injection technique targeting data-driven applications in which malicious SQL statements are embedded within user-supplied input that is subsequently incorporated into a database query without adequate sanitization or parameterization. The vulnerability arises when an application constructs SQL queries by concatenating or interpolating untrusted input directly into query strings, allowing an attacker to alter query structure and semantics. Depending on the application's database permissions and query context, exploitation may enable unauthorized data retrieval, data modification or deletion, authentication bypass, and in some configurations, execution of operating system commands. Successful exploitation requires that the injected payload reach the database interpreter and that the application's response, direct or inferential, provides the attacker with observable feedback or produces an exploitable side effect.
Why it matters
SQL injection is one of the most consequential vulnerability classes in web application security because it targets the database layer, where an application's most sensitive assets typically reside. Successful exploitation can result in unauthorized disclosure of user credentials, personally identifiable information, financial records, or proprietary business data. Beyond data theft, attackers may modify or delete records, corrupt application state, or, in certain database configurations, escalate access to underlying operating system resources.
Who it's relevant to
Inside SQLi
Common questions
Answers to the questions practitioners most commonly ask about SQLi.