# NukeViet CMS: Stored XSS via internal marker injection in iframe srcdoc sanitization

NukeViet's HTML sanitizer rebuilds tags with internal placeholder markers; entity-encoded brackets in iframe srcdoc forge those markers, yielding stored XSS.

- Payout: Research
- Severity: high
- Program: NukeViet
- Found by: Pbat6
- Disclosed: 2026-11-30
- CVE: CVE-2026-94598
- Write-up quality: 8/10
- Original: https://github.com/advisories/GHSA-p7cw-whjw-crcm
- Library page: https://bugbountylibrary.com/r/ghsa%3AGHSA-p7cw-whjw-crcm
- Tags: area:web domain:web impact:ato impact:privesc kind:research platform:ghsa sev:high tech:php technique:chained technique:source-review vuln:xss

**Target:** HTML sanitizer in NukeViet\Core\Request (filterTags/filterAttr), editor input via get_editor()
**Root cause:** filterTags() rebuilds allowed tags using internal placeholder markers ({@[, ]@}, [@{, }@]) and converts them back to <, > and " at the end, but never checks input for those markers; srcdoc content is entity-decoded before the recursive filterTags() call, so [/[/&lbrack; become real brackets that forge markers.
**Steps:**
1. Identify that iframe is in NV_ALLOWED_HTML_TAGS by default and srcdoc values are recursively filtered after entity decoding.
2. Submit editor input containing `<iframe srcdoc="{@[img src=x onerror=alert(document.domain)]@}"></iframe>` with brackets entity-encoded (`&#91;`, `&#x5b;`, `&lbrack;`).
3. Sanitizer decodes entities, marker survives filtering, and stored output is `<iframe srcdoc="&lt;img src=x onerror=alert(document.domain)&gt;"></iframe>`.
4. Victim views the stored content; browser decodes srcdoc and renders `<img src=x onerror=alert(document.domain)>` in a same-origin iframe.
**How found:** Code review of filterTags()/filterAttr(): noticed the sanitizer uses internal placeholder markers to rebuild tags and that srcdoc values are entity-decoded before the recursive call, hypothesizing markers could be forged via encoded brackets or joined with sanitizer-generated markers to leave a tag unclosed.
**Exploitation:** Unauthenticated attacker submits the payload via the guest-accessible contact form (or any comment/article editor field); when an administrator opens the message in the admin panel, the srcdoc iframe executes JavaScript in the admin origin, allowing reads of admin panel data and administrative actions with the victim's session. HttpOnly cookies and the default CSP ('unsafe-inline') do not prevent it.
**Escalation:** Same-origin srcdoc iframe turns a low-privilege/guest input into code execution in the administrator's origin, enabling admin-panel data theft and privileged actions.
**Insight:** When a sanitizer uses internal sentinel/placeholder tokens to rebuild markup, test whether entity decoding happens before or after token substitution and whether attacker input can forge or splice into those tokens (encoded brackets, partial tokens joined to generated ones).

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

**iframe srcdoc marker injection payload**

```
<iframe srcdoc="{@[img src=x onerror=alert(document.domain)]@}"></iframe>
```

