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

HTTP Request Smuggling due to CR-to-Hyphen conversion

Node.js converts a carriage return inside an HTTP header name into a hyphen before parsing, so a header such as Content[CR]Length becomes Content-Length. A front-end proxy that ignores the malformed header and a back-end that honours it disagree on where the request body ends, allowing a smuggled second request.

amitklein Follow

Originally disclosed on HackerOne

High 8.5 View original
  • Triaged in 17 days
  • Fixed in 2 months
  • Paid in 8 months
  • Disclosed after 3 months

NOTE! Thanks for submitting a report! Please replace all the [square] sections below with the pertinent details. Remember, the more detail you provide, the easier it is for us to triage and respond quickly, so be sure to take your time filling out the report!

Summary: [add summary of the vulnerability] Apparently, node.js converts CR in HTTP request headers to hyphen before parsing. This can lead to HTTP Request Smuggling as it is a non-standard interpretation of the header.

Description: [add more details about this vulnerability] Consider an HTTP request with Content[CR]Length header . Suppose a proxy in front of node.js ignores the Content[CR]Length header (and therefore assumes a 0-length body). node, on the other hand, converts the CR to a hyphen and uses the value of the (newly formed...) Content-Length header. HTTP Request Smuggling ensues.

Steps To Reproduce:

This is the HTTP stream that demonstrates the vulnerability: GET / HTTP/1.1 Host: www.example.com Content[CR]Length: 42 Connection: Keep-Alive

GET /proxy_sees_this HTTP/1.1 Something: GET /node_sees_this HTTP/1.1 Host: www.example.com

A proxy server that ignores the invalid Content[CR]Length header will assume that the body length is 0 (since there's no body length indication), and will thus transmit the stream up to (but not including) the GET /proxy_sees_this. It will wait for node to respond (which interestingly does happen, even though node.js does expect the body - perhaps on GET requests, the URL is invoked regardless of the body?), then the proxy forwards the second request (from its perspective) - the GET /proxy_sees_this. Node then silently discards the expected 42 bytes of the body of the first request, and thus starts parsing the 2nd request from GET /node_sees_this. HTTP Request Smuggling ensues.

[Also, if you were able to find the piece of code responsible for this issue, please add a link to it in the source repository.]

Impact: [add why this issue matters]

HTTP Request Smuggling can lead to web cache poisoning, session hijacking, cross site scripting, etc.

Supporting Material/References:

  • List any additional material (e.g. screenshots, logs, references, commits, code examples, etc.).

Impact

HTTP Request Smuggling can lead to web cache poisoning, session hijacking, cross site scripting, etc.

The original report as published on HackerOne, by amitklein. 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 HTTP parser normalises a carriage return in a header name to a hyphen instead of rejecting the malformed header, creating a Content-Length header the front-end proxy never saw.

Impact

Smuggled requests could enable web cache poisoning, session hijacking and cross-site scripting, though the report only demonstrates the desynchronisation itself.

What the attacker needed

A proxy that ignores the malformed header; node.js back-end behind that proxy

The fix

The parser should not convert a carriage return in a header name into a hyphen.

How it was found

  1. Send a request whose header name contains a carriage return before 'Length', so the proxy ignores it but node.js reads it as Content-Length.
  2. The proxy assumes a zero-length body and forwards only up to the next request line.
  3. Node.js waits for the declared body length, then discards those bytes and parses what follows as a new request.
  4. The smuggled request is parsed by node.js as a new request.

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.

A proxy marks where a request body ends with a Content-Length header. Here the server rewrites a broken header name into a valid one, so the proxy and server disagree about where one request stops and the next begins. An attacker can hide a second request inside the first.

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.