Summary
NukeViet CMS has a stored cross-site scripting flaw in how it filters HTML in iframe srcdoc content. An attacker who can submit content that is later viewed may bypass the sanitizer and cause JavaScript to run in the viewer's session when the iframe is unsandboxed.
Affected context
The issue affects NukeViet CMS versions from 4.5.08 up to the fixed releases 4.5.12 and 4.6.02. It arises when HTML filtering processes an iframe srcdoc value containing entity-encoded square brackets: recursive filtering can decode them into internal sanitizer markers, which are later converted to markup without normal tag or attribute filtering.
The iframe tag is enabled by default through NV_ALLOWED_HTML_TAGS, and an unsandboxed srcdoc iframe shares the parent page's origin. Relevant content paths can include Contact messages, comments when the editor is enabled, and submitted articles.
Exploit preconditions
- Attack surface: A NukeViet content submission or editing path that accepts iframe
srcdoccontent. - Required access: The ability to submit or modify content that will be stored; the description does not establish whether authentication is required.
- Trigger point: A viewer loads the stored content containing the filtered iframe.
- Why exploitation is possible: Recursive decoding can turn encoded characters into accepted internal sanitizer markers, which are later rendered as markup without normal tag or attribute filtering. An unsandboxed iframe can then execute script with the parent page's origin.
Why this happens
The sanitizer's recursive processing allows HTML-entity decoding to expose internal marker syntax after the input has passed through an earlier filtering stage. Later conversion of those markers to markup bypasses normal tag and attribute checks. This is a CWE-79 cross-site scripting weakness: untrusted content is not safely neutralized for its rendering context.
Potential impact
- Attacker-controlled JavaScript may execute when a viewer opens the affected content.
- A script could act with the viewer's site privileges and access session-reachable application functions.
- Viewer data or actions may be exposed or manipulated, depending on application controls and the viewer's permissions.
General mitigation guidance
Defensive approaches focus on ensuring untrusted content remains data throughout parsing and rendering:
- Use context-aware HTML sanitization that does not expose internal control markers to user input.
- Canonicalize or decode input consistently before validation, and avoid repeated transformations that can reveal previously hidden syntax.
- Apply strict allowlists for iframe attributes and content, and disable iframe support by default where it is not needed.
- Use sandboxing and restrictive origin policies for embedded content as defense in depth.
- Limit privileges available to user-submitted content and the actions exposed to authenticated sessions.
How teams detect issues like this
- Use static analysis and code review to find recursive decoding or filtering paths, internal sanitizer markers exposed to user-controlled input, and later marker-to-markup conversions.
- Review iframe
srcdochandling, HTML allowlists, and whether embedded frames are sandboxed. - Add security tests that verify entity-encoded input cannot become trusted markup after multiple processing stages.
- Enforce policies that require context-aware output encoding and approved sanitization APIs. Automated code review tools may help identify suspicious parsing and rendering patterns.

