CRLF Injection

Medium

CRLF Injection / HTTP Response Splitting

Definition

CRLF Injection occurs when an attacker can inject carriage-return (\r) and line-feed (\n) characters into the HTTP response headers. This lets them split the HTTP response, inject arbitrary headers, set malicious cookies or even inject HTML/JavaScript content into the response body.

Impact

Injection of arbitrary HTTP headersSetting malicious cookies (session fixation)Cross-Site Scripting (XSS) through injection into the response bodyWeb cache poisoningBypassing security policies (CSP, CORS)

Examples

CRLF Injection to inject a Set-Cookie header

By injecting %0d%0a (URL-encoded CRLF) into the parameter, the attacker can add arbitrary HTTP headers such as Set-Cookie, potentially fixing a session or setting malicious cookies.

# Legitimate URL with a redirect parameter
GET /redirect?url=/dashboard HTTP/1.1

# CRLF payload
GET /redirect?url=%0d%0aSet-Cookie:%20admin=true%0d%0a HTTP/1.1

# Server response:
HTTP/1.1 302 Found
Location: /dashboard
Set-Cookie: admin=true

Practice CRLF Injection with real labs

Apply what you've learned in safe environments based on real bug bounty reports.

See practice labs
2,482

hunters training

62

labs from real hacks

1,630

completions

$14,790

paid out for these bugs

11 flags captured this week·Real hacks from HackerOne · YesWeHack · Bugcrowd·No commitment·Free Academy
Free · no account

The checklist I run on every new target

47 checks ordered by cost: first what can get you in trouble, then the cheap stuff, and finally the expensive stuff — which is where the big bounties are. I'll send it to your inbox right now.

Unsubscribe in one click, from any email.

BBLabs · bug bounty training

Stop reading about bugs and start hunting them

Create your free account and practice on labs based on real hacks that paid out thousands of euros. The Academy is free forever.

No card · free Academy · cancel anytime