Injection attacks refer to a broad class of attack vectors that allow an attacker to supply untrusted input to a program, which gets processed by an interpreter as part of a command or query which alters the course of execution of that program. Injection attacks are amongst the oldest and most dangerous web application attacks. They can result in data theft, data loss, loss of data integrity, denial of service, as well as full system compromise.
Injection is a major problem in web security. It is listed as the number-one web application security risk in the the OWASP Top 10 — and for good reason. Injection attacks, particularly SQL injection (SQLi) and Cross-site Scripting (XSS), are not only very dangerous, but they are also very widespread, especially in legacy applications.
What makes injection attacks particularly scary is that their attack surface is enormous (especially for SQLi and XSS). Furthermore, Injection attacks are a very well understood vulnerability class, meaning that that there are countless freely available and reliable tools that allow even inexperienced attackers to abuse these vulnerabilities automatically.
Types of injection attacks
While SQL injection (SQLi) and Cross-site Scripting (XSS) are the most commonly talked about injection attacks, they are by far not the only ones.
The following is a list of common injection attacks.
|Injection attack||Descriptions||Potential impact|
|Code injection||Injects application code which can execute operating system commands as the user running the web application. Advanced attacks can make use of privilege escalation vulnerabilities to gain even higher privileges if necessary, which may lead to full system compromise.||Full system compromise|
|CRLF injection||Injects an unexpected CRLF (Carriage Return and Line Feed) character sequence used to split an HTTP response header and write arbitrary contents to the response body, including Cross-site Scripting (XSS).||Cross-site Scripting (XSS)|
|Email (Mail command/SMTP) injection||Injects IMAP/SMTP statements to an mail server that is not directly available via a web application.||
|Host header injection||Abuses the implicit trust of the HTTP Host Header to poison password-reset functionality and poison web caches.||
|LDAP injection||Injects LDAP (Lightweight Directory Access Protocol) statements to execute arbitrary LDAP commands including granting permissions and modifying the contents of an LDAP tree.||
|OS Command injection||Injects operating system commands as the user running the web application. Advanced variations of this attack can leverage privilege escalation vulnerabilities which may lead to full system compromise.||Full system compromise|
|SQL injection (SQLi)||Injects SQL commands that can read or modify data from a database. Advanced variations of this attack can be used to write arbitrary files to the server and even execute OS commands which may lead to full system compromise.||
|XPath injection||Inject data into an application to execute crafted XPath queries which can be used to access unauthorized data and bypass authentication.||