# Stored XSS via SMTP Error Message

Attacker-controlled SMTP server returns a rejection message containing an XSS payload, which xvideos renders unsanitized via html() on the email validation page.

- Payout: $250
- Severity: low
- Program: XVIDEOS
- Found by: chse_
- Disclosed: 2025-01-24
- Write-up quality: 7/10
- Original: https://hackerone.com/reports/2956266
- Library page: https://bugbountylibrary.com/r/h1%3A2956266
- Tags: area:web domain:web impact:ato impact:data-leak kind:bounty platform:hackerone sev:low tech:email technique:oob-exfil technique:second-order vuln:xss

**Target:** Email validation page /account/email rendering SMTP bounce errors
**Root cause:** SMTP error/bounce messages returned by the recipient's mail server are inserted into the page via the html() method without sanitization, so attacker-controlled text in the SMTP rejection response becomes executable HTML/JS.
**Steps:**
1. Configure Postfix with `check_recipient_access` and a recipient_access entry: `invalid@example.org REJECT 5.1.1 <img src="" onerror="alert('hackerone!')" />`
2. Run `postmap /etc/postfix/recipient_access` and restart Postfix
3. Register an xvideos account using `invalid@example.org`
4. Go to `/account/email` and click 'Please click Here to validate it'
5. Wait ~45 minutes for the bounce to be processed and rendered; payload fires
**How found:** Researcher reasoned that SMTP bounce/error text is attacker-controllable (own the mail server) and tested whether the app renders it as HTML rather than text, by embedding an img/onerror payload in the SMTP rejection message.
**Exploitation:** Attacker controls the MX/SMTP server for the email domain used at signup. When xvideos sends the validation email, the attacker's server rejects it with a crafted SMTP error string containing an HTML/JS payload. The application stores/renders that bounce message via html() on the victim's /account/email page, executing script in the xvideos origin.
**Escalation:** Potential account takeover if staff view a user's bounce history in the same unsanitized context; also affects users who mistype their email domain to an attacker-controlled domain.
**Insight:** Anywhere an app displays inbound email bounce/SMTP response text, control the recipient's MX and inject HTML into the SMTP rejection string — the app trusts server-generated error text as safe.

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

**Postfix recipient_access REJECT with XSS payload**

```
invalid@example.org REJECT 5.1.1 <img src="" onerror="alert('hackerone!')
```

