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

CVE-2022-32213 bypass via obs-fold mechanic

The fix for CVE-2022-32213 in Node's HTTP parser can be bypassed by using an obsolete line folding (obs-fold) continuation line after the Transfer-Encoding header. A server using the Node HTTP module as a proxy would accept the chunked request and forward a malformed transfer-encoding value downstream, which can lead to HTTP request smuggling.

haxatron1 Follow

Originally disclosed on HackerOne

  • Triaged in 21 hours
  • Fixed in 3 months
  • Disclosed after 4 months

Summary

The fix for CVE-2022-32213 can be bypass using an obs-fold, which Node's http parser supports

Proof-Of-Concept

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("Headers: " + JSON.stringify(request.headers));
  });
}).listen(5000);

Send the obs-fold via curl

curl -vv -H $'Transfer-Encoding: chunked\r\n abc' --data "A" http://127.0.0.1:5000

See that the server accepted the chunked request, and will incorrectly fold abc to the value of the Transfer-Encoding header. This is seen in the value of "transfer-encoding" as "chunked abc" in the printed headers.

Headers: {"host":"127.0.0.1:5000","user-agent":"curl/7.83.1","accept":"*/*","transfer-encoding":"chunked abc","content-type":"application/x-www-form-urlencoded"}

Impact

If nodejs HTTP module is used as a proxy, then it incorrectly parses the transfer-encoding header as indicative of chunked request, while folding the headers and hence forwarding Transfer-Encoding: chunked abc which is not a valid transfer-encoding header to the downstream server. As such this can lead to the HTTP request smuggling as indicated by CVE-2022-32213.

The original report as published on HackerOne, by haxatron1. 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 still accepts obsolete line folding (a header value continued on the next line starting with whitespace) and folds it into the Transfer-Encoding value instead of rejecting it, so the header no longer matches the strict chunked form the fix expected.

Impact

If the Node HTTP module is used as a proxy, it forwards a malformed transfer-encoding header to the downstream server, which could lead to HTTP request smuggling as described in CVE-2022-32213.

What the attacker needed

Node HTTP module used as a proxy; attacker can send crafted requests

The fix

The parser should not fold obs-fold continuation lines into the Transfer-Encoding value, as this bypasses the CVE-2022-32213 fix.

How it was found

  1. Run a small Node HTTP server that echoes back the parsed request headers.
  2. Send a request with curl that includes a Transfer-Encoding header followed by an obs-fold continuation line.
  3. Observe that the server accepts the chunked request and shows the transfer-encoding value as chunked plus the folded text.

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.

Node's web server code can be tricked into reading a header differently from the server behind it, so the two may disagree about message boundaries. This can lead to request smuggling.

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 haxatron1

View all

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