CRLF Injection

Rejah Rehim
Published on
19 Jun 2018

Carriage Return and Line Feed Injection (CRLF) is a type of injection attack that can cause Cross-site Scripting (XSS) attacks. This can also cause web cache poisoning among others. This server is vulnerable to Carriage Return and Line Feed Injection. This is because the server fails to properly escape/remove CRLF characters in the user’s inputs. This vulnerability leads to various attacks including web cache poisoning, cross user defacement, hijacking pages with sensitive user information and cross-site scripting.


The below URL has been split response header. text/html%0d%0aHTTP/1.1 200 OK%0d%0aContent-Type: text/html%0d%0a%0d%0a%3Cscript%3Ealert(1)%3C/script%3E

The user will see the following




The vulnerabilities include :-

  • Web cache poisoning
  • cross-user defacement
  • Cross-site scripting

Mitigation / Precaution

Beagle recommend the following fixes:-

  • restrict CR(0x13) and LF(0x10) from the user input
  • Properly encode the output in order to prevent the injection of custom HTTP headers
Automated human-like penetration testing for your web apps & APIs
Teams using Beagle Security are set up in minutes, embrace release-based CI/CD security testing and save up to 65% with timely remediation of vulnerabilities. Sign up for a free account to see what it can do for you.

Written by
Rejah Rehim
Rejah Rehim
Co-founder, Director
Find website security issues in a flash
Improve your website's security posture with proactive vulnerability detection.
Free website security assessment