Crlf Là Gì

A CRLF injection attaông xã is one of several types of injection attacks. It can be used to lớn escalate to lớn more malicious attacks such as Cross-site Scripting (XSS), page injection, web cabịt poisoning, cache-based defacement, và more. A CRLF injection vulnerability exists if an attacker can inject the CRLF characters inkhổng lồ a website application, for example using a user input đầu vào khung or an HTTPhường request.quý khách sẽ xem: Crlf là gì

The CRLF abbreviation refers to lớn Carriage Return and Line Feed. CR & LF are special characters (ASCII 13 và 10 respectively, also referred to as ) that are used khổng lồ signify the End of Line (EOL). The CRLF sequence is used in operating systems including Windows (but not Linux/UNIX) and Internet protocols including HTTP..

Bạn đang xem: Crlf là gì

There are two most comtháng uses of CRLF injection attacks: log poisoning và HTTP response splitting. In the first case, the attacker falsifies log file entries by inserting an kết thúc of a line and an extra line. This can be used to lớn hide other attacks or to lớn confuse system administrators. In the second case, CRLF injection is used khổng lồ add HTTPhường headers lớn the HTTP. response và, for example, perkhung an XSS attack that leads khổng lồ information disclosure. A similar technique, called Email Header Injection, may be used to lớn add SMTPhường. headers khổng lồ emails.


What Is HTTP Response Splitting

The HTTPhường. protocol uses the CRLF character sequence lớn signify where one header ends and another begins. It also uses it to signify where headers kết thúc và the trang web content begins.

If the attacker inserts a single CRLF, they can add a new header. If it is, for example, a Location header, the attacker can redirect the user to a different website. Criminals may use this technique for phishing or defacing. This technique is often called HTTP header injection.

If the attacker inserts a double CRLF, they can prematurely terminate HTTP headers and inject content before the actual website content. The injected nội dung can contain JavaScript code. It can also be formulated so that the actual trang web nội dung coming from the web hệ thống is ignored by the website browser. This is how HTTP. response splitting is used in combination with Cross-site Scripting (XSS).

The following simplified example uses CRLF to:

Add a fake HTTPhường response header: Content-Length: 0. This causes the website browser to treat this as a terminated response & begin parsing a new response.Add a giả HTTPhường response: HTTP/1.1 200 OK. This begins the new response.Add another fake HTTP.. response header: Content-Type: text/html. This is needed for the website browser khổng lồ properly parse the nội dung.Add yet another kém chất lượng HTTP. response header: Content-Length: 25. This causes the web browser lớn only parse the next 25 bytes.Add page nội dung with an XSS: . This nội dung has exactly 25 bytes.Because of the Content-Length header, the web browser ignores the original nội dung that comes from the website VPS.

Xem thêm: Error - Camtasia Studio 2018 Full Crack

Finding and Mitigating CRLF Injections

The impact of CRLF injections may seem khổng lồ be limited. CRLF injections are not even mentioned in the OWASP.. trang nhất 2017 website application security danh mục. However, attackers can effectively use CRLF injections to lớn escalate lớn much more serious attacks that exploit other website application vulnerabilities. Therefore, you should treat CRLF injection vulnerabilities seriously.

Fortunately, it’s easy to thử nghiệm if your trang web or website application is vulnerable to lớn CRLF injections and other vulnerabilities by running an automated web scan using the vulnerability scanner. Take a kiểm tra và find out more about running a scan against your website or website application.

CRLF injection vulnerabilities are usually mitigated by web frameworks automatically. Even if the vulnerability is not mitigated, it is very simple khổng lồ fix:

Option 1: Rework your code so that nội dung supplied by the user is never used directly in the HTTP stream.Option 2: Strip any newline characters before passing nội dung into the HTTPhường header.Option 3: Encode the data that you pass inkhổng lồ HTTPhường. headers. This will effectively scramble the CR and LF codes if the attacker attempts to lớn inject them.

How to lớn Prevent CRLF Injections

CRLF injection vulnerabilities are usually mitigated by website frameworks automatically. Even if the vulnerability is not mitigated, it is very simple to lớn fix.


Step 1: Don’t trust user input

Rework your code so that content supplied by the user is never used directly in the HTTP. stream.




Step 4: Scan regularly (with

CRLF injections may be introduced by your developers or through external libraries/modules/software. You should regularly scan your website applications using a web vulnerability scanner such as If you use Jenkins, you should install the plugin khổng lồ automatically scan every build.
Chuyên mục: Hỏi Đáp