CRLF

CWE-93: Improper Neutralization of CRLF Sequences ('CRLF Injection')

#What is CRLF injection?

CRLF injection is a vulnerability that lets a malicious hacker inject carriage return (CR) and linefeed (LF) characters to change the way a web application works or to confuse its administrator. There are two main malicious uses for CRLF injections: log poisoning (also called log injection, log splitting, or log forging) and HTTP response splitting.

Carriage Return Line Feed

The term CRLF refers to Carriage Return (ASCII 13, \r) Line Feed (ASCII 10, \n). They're used to note the termination of a line, however, dealt with differently in today’s popular Operating Systems. For example: in Windows both a CR and LF are required to note the end of a line, whereas in Linux/UNIX a LF is only required. In the HTTP protocol, the CR-LF sequence is always used to terminate a line.

A CRLF Injection attack occurs when a user manages to submit a CRLF into an application. This is most commonly done by modifying an HTTP parameter or URL.

Summary

  • CRLF - Add a cookie

  • CRLF - Add a cookie - XSS Bypass

  • CRLF - Write HTML

  • CRLF - Filter Bypass

  • Labs

  • References

Requested page

HTTP Response

Requested page

HTTP Response

CRLF - Write HTML

Requested page

HTTP response

CRLF - Filter Bypass

Using UTF-8 encoding

Remainder:

  • %E5%98%8A = %0A = \u560a

  • %E5%98%8D = %0D = \u560d

  • %E5%98%BE = %3E = \u563e (>)

  • %E5%98%BC = %3C = \u563c (<)

#What is log poisoning?

In a log poisoning attack based on CRLF injection, a malicious hacker injects CRLF chara​cters into web server log files to confuse both automatic log analysis systems and system administrators browsing the logs manually.

CRLF_Injection Example

Labs

References

Last updated

Was this helpful?