# Wrong Handling of Content-Type allows Flash injection and Rosseta flash patch bypass

Flash player string-searches Content-Type for application/x-shockwave-flash, so injecting that string into a header param lets attacker-uploaded files execute as Flash, bypassing nosniff and the Rosetta Flash patch.

- Payout: $3,000
- Severity: high
- Program: Internet Bug Bounty
- Found by: benhayak
- Disclosed: 2019-11-12
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/78158
- Library page: https://bugbountylibrary.com/r/h1%3A78158
- Tags: area:os domain:browser impact:ato kind:bounty platform:hackerone sev:high tech:java technique:incomplete-fix technique:parser-differential technique:source-review vuln:misconfiguration vuln:xss

**Target:** Adobe Flash Player Content-Type handling / servlet rendering user-controlled header params
**Root cause:** Flash matches the substring application/x-shockwave-flash anywhere in the Content-Type header rather than requiring it as the MIME type, enabling MIME sniffing and bypassing X-Content-Type-Options: nosniff and the Rosetta Flash alphanumeric mitigation.
**Steps:**
1. Upload a malicious SWF disguised as an image (flashsniff.png) to a servlet that reflects a lang/encoding param into Content-Type.
2. Request it with `?imgId=1234&lang=application/x-shockwave-flash` so the response is `Content-Type: image/png; charset=utf-8; lang=application/x-shockwave-flash`.
3. Embed `<object type="application/x-shockwave-flash" data="...&lang=application/x-shockwave-flash"><param name="AllowScriptAccess" value="always"></object>` in an attacker page.
4. Flash executes the file despite nosniff; for Rosetta bypass, point the object at a JSONP endpoint whose Content-Type contains the magic string to regain alphanumeric-only Flash execution and SOP bypass.
**How found:** Reversed the Rosetta Flash mitigation and noticed Flash uses indexOf-style string search over the whole Content-Type value; hypothesized that any header containing the magic string (e.g. via lang param) would trigger Flash execution, then tested with uploaded images and JSONP endpoints.
**Exploitation:** Attacker hosts a page embedding the vulnerable endpoint as a Flash object; Flash sniffs the injected Content-Type, executes attacker-controlled bytes as SWF, and with AllowScriptAccess=always performs cross-domain actions/SOP bypass to read victim data.
**Escalation:** Chains MIME sniffing with the Rosetta Flash JSONP technique to bypass the alphanumeric-only mitigation and restore SOP bypass via JSONP endpoints.
**Insight:** When a client sniffs MIME by substring rather than exact match, look for any reflected header parameter (lang, charset, encoding) that lets you smuggle the magic MIME string past nosniff; also re-test vendor mitigations for substring-vs-exact-match gaps.

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

**Flash object embedding vulnerable image servlet with lang param**

```
<object type="application/x-shockwave-flash"
data="http://vulnerable-site.com/RenderImageServlet.php?imgId=1234&lang=application/x-shockwave-flash">
<param name="AllowScriptAccess" value="always">
</object>
```

**Vulnerable response header with injected flash MIME**

```
HTTP/1.1 200 OK
....
X-Content-Type-Options: nosniff
....
Content-Length: 733
Content-Type: image/png; charset=utf-8; lang=application/x-shockwave-flash
```

