Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 237

CRLF Injection

What is CRLF Injection?

CRLF InjectionAn attack that inserts carriage-return and line-feed characters into HTTP headers, log files, or other text protocols to forge new lines and change semantics.


CRLF injection abuses the special meaning of the CR (0x0D) and LF (0x0A) byte sequence that terminates lines in many text-based protocols. When an application reflects unvalidated user input into HTTP response headers, log entries, SMTP commands, or LDAP queries, an attacker can inject a CRLF pair followed by additional content to forge headers, split responses, hide entries in logs, or smuggle commands. In web contexts, the most damaging form is HTTP response splitting, which can poison shared caches, set arbitrary cookies, or inject XSS into a controlled response body. Defenses include rejecting CR/LF in user input destined for headers, using high-level APIs that escape them, and strict log encoders.

Examples

  1. 01

    Set-Cookie: id=foo%0d%0aSet-Cookie: admin=true — adds a second cookie via CRLF.

  2. 02

    Location: /redir%0d%0aContent-Length:0%0d%0a%0d%0a<html>... — HTTP response splitting.

Frequently asked questions

What is CRLF Injection?

An attack that inserts carriage-return and line-feed characters into HTTP headers, log files, or other text protocols to forge new lines and change semantics. It belongs to the Attacks & Threats category of cybersecurity.

What does CRLF Injection mean?

An attack that inserts carriage-return and line-feed characters into HTTP headers, log files, or other text protocols to forge new lines and change semantics.

How does CRLF Injection work?

CRLF injection abuses the special meaning of the CR (0x0D) and LF (0x0A) byte sequence that terminates lines in many text-based protocols. When an application reflects unvalidated user input into HTTP response headers, log entries, SMTP commands, or LDAP queries, an attacker can inject a CRLF pair followed by additional content to forge headers, split responses, hide entries in logs, or smuggle commands. In web contexts, the most damaging form is HTTP response splitting, which can poison shared caches, set arbitrary cookies, or inject XSS into a controlled response body. Defenses include rejecting CR/LF in user input destined for headers, using high-level APIs that escape them, and strict log encoders.

How do you defend against CRLF Injection?

Defences for CRLF Injection typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for CRLF Injection?

Common alternative names include: Carriage return line feed injection, Log injection.

Related terms