Summary
NukeViet CMS can store Contact module content containing numeric HTML entities that evade URL-scheme filtering but are decoded by browsers when rendered. An unauthenticated visitor may use this behavior to run script in the administration origin when staff view a message, potentially enabling actions with the viewer's privileges.
Affected context
The issue affects NukeViet CMS releases before 4.6.01 in the Contact module's handling of submitted content. It becomes risky when a visitor can submit a message containing a URL-bearing attribute on an allowed HTML element, and an administrator or staff member later views that stored message. The mismatch between server-side entity handling and browser rendering can leave a script URL undetected.
Exploit preconditions
- Attack surface: Public Contact module submission and subsequent rendering of stored messages
- Required access: An unauthenticated visitor can submit content; no account is required for submission
- Trigger point: A staff member views the submitted message in the administration origin
- Why exploitation is possible: Numeric entities with more than eight leading zeros are not decoded by
unhtmlentities()beforefilterAttr()checks the URL scheme, while the browser decodes them during rendering
Why this happens
The underlying issue is a parser and normalization mismatch. NukeViet checks a URL-bearing attribute before decoding the specific numeric-entity form, but the browser later decodes it and interprets the resulting value as a script URL. This is CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting), with CWE-172 relevant to encoding handling and CWE-184 relevant to incomplete filtering.
Potential impact
- Script could run in the administration origin when staff view a crafted message.
- The script could perform actions available to the staff member, subject to their permissions.
- An attacker could potentially ride an authenticated staff session, though the HttpOnly session cookie cannot be read directly by page script.
- Administrative data or workflows could be affected depending on the viewer's access.
General mitigation guidance
Defensive patterns focus on making validation and rendering use consistent, safe interpretations of input:
- Prefer context-aware output encoding and avoid rendering submitted HTML when it is not required.
- If HTML is needed, use a well-maintained allowlist sanitizer that normalizes entities before validating attributes and URL schemes.
- Allow only explicitly approved URL schemes and remove or neutralize unsafe URL-bearing attributes.
- Apply restrictive content security policies and consider isolating user-submitted content from the administration origin.
- Limit staff privileges to the minimum needed, reducing the impact of script execution in an authenticated interface.
How teams detect issues like this
- Use static analysis to find HTML rendering paths where user-controlled content reaches output without context-aware encoding or established sanitization.
- Review entity decoding, URL-scheme checks, and filtering order for inconsistent normalization behavior.
- Test sanitizers against unusual numeric-entity forms and verify that server-side validation matches browser parsing.
- Enforce code-review or CI policies requiring approved output-encoding and HTML-sanitization APIs for untrusted content.

