CRLF Injection

Published on 19 Jun 2018
Vulnerability
Injection
CRLF

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.

Example

The below URL has been split response header.

http://www.example.beaglesecurity.com/randompage.php?page=%0d%0aContent-Type: 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

        <script>alert(10)</script>

    

Impact

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
Rejah Rehim
Written by
Co-founder, Director

Rejah brings more than 12 years of industry experience in Information Technology. He is a fervent security enthusiast and serves as a Project Leader at OWASP Foundation, and Commander (Hon.) at Kerala Police. He has authored two books titled “Effective Python Penetration Testing” and “Python Penetration Testing Cookbook” and is the creator of 9 Mozilla add-ons.

Experience the Beagle Security platform
Unlock one full penetration test and all Advanced plan features free for 14 days
4.8 on G2 • ISO 27001 certified
See How Beagle Security Works
No credit card • No setup required
Launch interactive demo