CRLF Injection

OWASP 2013-A1 OWASP 2017-A1 OWASP 2021-A3 PCI v3.2-6.5.1 OWASP PC-C4 CWE-113 HIPAA-164.306(a) & HIPAA-164.308(a) ISO27001 A.14.2.5 WASC-24 {"CVSS:3.0"=>"AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:H"} WSTG-INPV-15

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







Related Articles