Pcornel
Browse topics
Options
Recent
Favorites
Security · Technical reference

Injection

Direct answer

Injection (OWASP A03) happens when untrusted input is interpreted as code or queries — SQL, OS commands, LDAP or XSS. Use parameterized queries, safe APIs, input validation and output encoding.

When to use this

Use this when untrusted input reaches interpreters (OWASP A03).

First 30 seconds

1. Injection: SQL, NoSQL, OS command, LDAP, XSS.

2. Parameterise, encode, validate.

3. Safe APIs.

4. Least privilege.

5. Test continuously.

Operational verification

untrusted input → safe API → no interpretation as code

Context & applicabilityCommon mistakes · platform/version boundaries
Common mistakes
Common mistakes
  • Blacklisting characters instead of using safe APIs.
  • Validating on the client only.
  • Trusting data from internal services or databases (second-order injection).
  • Logging raw input that later gets rendered in an admin panel (stored XSS).
Platform / version applicability
Security architecture and operations
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformSecurity architecture and operations
Scope / prerequisiteUse this when untrusted input reaches interpreters (OWASP A03).
What next?2 suggested next steps
Evidence1
On this pageJump to a specific section
Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Key points
  • Use parameterized queries.
  • Encode output for its context.
  • Validate input.
Key checks
  • SAST findings for injection — code issues
  • sqlmap/ZAP (authorised) — dynamic tests
  • Parameterised APIs used — prevention
ReferenceWhy it matters1 section · depth on demand

Defences by type

InjectionDefence
SQLParameterised queries / ORM
OS commandNo shell; argument lists; allowlists
LDAPEscape filter values; parameterised APIs
XSSOutput encoding, CSP
Template (SSTI)Never render user input as a template

General rule: keep data and code separate, validate input against allowlists, and run with least privilege.

ReferenceImportant terms & boundaries2 sections · depth on demand

In depth

Injection happens when untrusted input is interpreted as part of a command or query: SQL, NoSQL, OS commands, LDAP, XPath, template engines, or expression languages. The attacker's data changes what the application executes.

Injection typePrimary defence
SQLParameterised queries / ORM
OS commandAvoid shells; argument lists; allow-list validation
LDAPEscape special characters, parameterised filters
NoSQLTyped queries, reject operator objects in input
Template (SSTI)Never render user input as templates; sandboxed engines
Header/log injectionEncode CR/LF and control characters

Cross-site scripting is also an injection (into HTML/JavaScript). Common principle: keep data and code separate, validate input against allow-lists, and use safe APIs that do the separation for you.

Injection types

TypeSinkDefence
SQLDatabase queriesParameterised queries
OS commandShellAvoid shell, argument arrays
LDAPDirectory filtersEscape filter characters
NoSQLMongoDB operatorsReject objects where strings are expected ($ne)
Template (SSTI)Template enginesNever render user input as a template
XSSBrowserContext-aware output encoding
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docSecurity architecture and operations current

Authoritative/upstream documentation reviewed for bounded claims in OWASP → Injection. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://owasp.org/www-project-application-security-verification-standard/ · confidence 94%
Confirmation

Confirm action

Continue?