CRLF Injection

CRLF Injection

Knowledge Base>CRLF Injection

Summary

CRLF Injection allows an attacker to inject malicious CR and LF characters into application inputs, leading to potential HTTP response splitting, session hijacking, or cache poisoning.

Testing methodology

%0D%0ASet-Cookie:a=a%0d%0aLocation: http://a.comLocation, Content-Type, Inject Script Tag in ResponseAttacker Prefix to Complete Second RequestInject CORSBypass Security MechanismsInject a New HTTP Request
Identify Inputs
Response Splitting
XSS
Redirect
Header Injection
SSRF
Request Smuggling

Description

CRLF (Carriage Return Line Feed) Injection is a vulnerability that occurs when an attacker can inject CR and LF characters into application inputs, which can manipulate the behavior of HTTP responses or headers. Attackers can exploit this vulnerability to perform HTTP response splitting attacks, session hijacking, or cache poisoning, potentially leading to unauthorized access, sensitive information leakage, or malicious content injection.

Remediations

  • Implement strict input validation and sanitization to block CRLF characters.
  • Encode or sanitize user input before using it in HTTP responses or headers.
  • Use a secure framework or library that automatically handles encoding and sanitization of user input.
  • Regularly update and patch the web application's underlying software.

By using this site you agree to our Terms of Service and Privacy Policy.