2.4
In progress
Injection Attacks
Summary
Injection attacks send untrusted input that an application passes to an interpreter, such as a database, browser, XML parser or directory service, which then treats it as code. Client-side injection targets users' browsers; server-side injection targets back-end systems.
Detailed explanation
- Injection attack: Supplying input that changes the meaning of a command or query processed by an interpreter.
- Client-side attack: Runs in the user's browser or device, such as cross-site scripting.
- Server-side attack: Runs on the server or its back-end systems, such as SQL injection.
Types
- Persistent XSS: Script stored by the application and served to every visitor.
- SQL injection: Input alters a database query, exposing or changing data.
- XML injection: Input alters XML documents or how they are parsed; XML external entity (XXE) flaws can expose files or reach internal systems.
- LDAP injection: Input alters directory queries, potentially bypassing authentication or exposing directory data.
Indicators
- Signs: Special characters and query syntax in input fields and logs, database or parser errors, unexpected query results and unusual data access volumes.
Defenses
- Controls: Parameterized queries, input validation with allow lists, output encoding, escaping special characters, disabling external entities in XML parsers, least-privilege service accounts and WAFs.
Important terms
taken from the text above- Injection attack
- Supplying input that changes the meaning of a command or query processed by an interpreter.
- Client-side attack
- Runs in the user's browser or device, such as cross-site scripting.
- Server-side attack
- Runs on the server or its back-end systems, such as SQL injection.
- Persistent XSS
- Script stored by the application and served to every visitor.
- SQL injection
- Input alters a database query, exposing or changing data.
- XML injection
- Input alters XML documents or how they are parsed; XML external entity (XXE) flaws can expose files or reach internal systems.
- LDAP injection
- Input alters directory queries, potentially bypassing authentication or exposing directory data.
What I should remember
- Injection: Untrusted input interpreted as code.
- XML external entity (XXE): Parser flaw exposing files or internal resources.
- LDAP injection: Manipulates directory queries.
- Parameterized queries and input validation: Core defenses.