Simulations/HTTP Header Injection

HTTP Header Injection

Intermediate

This redirect endpoint places user input directly into the Location header without sanitizing newlines. Exploit CRLF injection to add a malicious Set-Cookie header, then learn how to prevent it.

Progress:
1
CRLF Header Injection
2
Apply Sanitization
app.example.com/redirect

Redirect Endpoint

The server takes the next parameter and places it into a Location header for a 302 redirect.

HTTP Response
HTTP/1.1 302 Found
Location: /dashboard?next=...
Content-Type: text/html

Challenges

1
CRLF Header Injection
Inject a malicious Set-Cookie header into the HTTP response by exploiting CRLF in the redirect URL.
▼ hints
2
Apply Sanitization
Select the correct approach to prevent HTTP header injection.
▼ hints
How to fix HTTP header injection
Sanitize newlines from any user input used in HTTP headers
▼

Frequently Asked Questions