injection
A bug where untrusted data reaches an interpreter and part of it is read as code instead of as a value.
An attacker who controls part of a command controls what the system does.
In more detail
The interpreter may be a database, a shell, a template engine, a browser or a directory server; the payload changes but the shape never does. Concatenating caller text into a command destroys the difference between code and data, so the fix is to keep data on a separate channel: parameters first, an allowlist where there is no parameter slot, and library escaping last.
Related terms
- SQL injection — An attack where untrusted input is joined into a database query so that part of it runs as SQL, letting an attacker read or change data.
- command injection — An attack where input meant as data, such as a file name or form field, gets run as commands because a program built code from it.
- template injection — An injection attack where a user supplies the template itself, letting them walk into objects and data the template was never meant to show.
- cross-site scripting — An attack in which someone gets their own script to run inside your page, where it can read data, act as the user or steal tokens.
- interpreter — A program that reads source code and carries it out at run time, instead of translating it into machine code in advance.
Taught in
- Injection In All Its Forms — Application Security & Threat Modeling for Engineers
- SQL Injection: The Exploit — Application Security & Threat Modeling for Engineers
- SQL Injection: The Fix — Application Security & Threat Modeling for Engineers
- Cross-Site Scripting — Application Security & Threat Modeling for Engineers
- Static Application Security Testing — Application Security & Threat Modeling for Engineers