Summary
NukeViet CMS up to version 4.5.07 contains a stored cross-site scripting (XSS) vulnerability in its Request class due to insufficient server-side sanitization of user-submitted HTML content.
An anonymous attacker can inject malicious scripts that are stored on the server and later executed in the browsers of users who view the affected content, potentially leading to session hijacking, account misuse, and phishing attacks.
Affected context
The vulnerability arises in contexts where NukeViet CMS accepts rich user-generated content via HTTP requests, such as contact forms, comments, or similar modules.
The Request class performs only limited or client-side-centric filtering of HTML tags and attributes, allowing crafted requests to bypass protections when client-side checks are tampered with or skipped.
Any feature that stores user input and later renders it in other users' browsers without robust server-side sanitization is potentially affected, irrespective of the specific module used as the original proof of concept.
Exploit preconditions
- Attack surface: Public-facing endpoints that accept user-submitted content (e.g., contact forms, comments, messages).
- Required access: None beyond the ability to submit HTTP requests; exploitation can be performed by unauthenticated, anonymous visitors.
- Trigger point: Viewing of stored, attacker-controlled content by another user (including administrators or moderators) in a browser.
- Why exploitation is possible: The server trusts client-side filtering and lacks comprehensive server-side sanitization/encoding of dangerous HTML tags and attributes, allowing malicious script injection to be stored and later executed when rendered.
Why this happens
The root cause aligns with CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting).
The Request class relies heavily on client-side filtering to remove or constrain HTML tags and attributes, assuming user agents will not bypass those checks.
By not performing rigorous server-side sanitization and encoding before storing and rendering user input, the application generates HTML pages that directly embed untrusted content.
This design allows crafted payloads that include script-capable constructs (e.g., dangerous tags, attributes, or event handlers) to persist in the system and execute in users' browsers when the affected content is displayed.
Potential impact
- Session hijacking through theft of cookies or session tokens, subject to cookie flags and browser protections.
- Execution of unauthorized actions in the application under the victim's identity (stored XSS-driven CSRF-like behavior).
- Defacement of pages or injection of misleading content, including redirects to phishing or malicious sites.
- Targeted phishing or social engineering via manipulated content and email notifications that embed attacker-controlled HTML.
- Exposure of sensitive information accessible within the victim's authenticated context (e.g., administrative views).
General mitigation guidance
Effective mitigation focuses on enforcing server-side trust boundaries and applying defense-in-depth for untrusted HTML.
Recommended patterns include:
- Implement robust server-side HTML sanitization in the input handling layer (such as the Request class), normalizing or stripping unsafe tags (e.g., <script>, <iframe>, embedded objects) and attributes (e.g., srcdoc, javascript: URLs, event handlers like onerror/onload).
- Prefer a default-deny sanitization model where only a minimal, explicitly allowed subset of tags and attributes is permitted, rather than attempting to blacklist dangerous constructs.
- Apply context-appropriate output encoding (e.g., HTML, attribute, URL encoding) when rendering user-provided data back into views.
- Use templating systems and helper APIs that encode values by default, reducing the chance of raw injection into HTML, attributes, or script contexts.
- Enforce a restrictive Content Security Policy (CSP) that, where feasible, disallows inline scripts, limits script sources to trusted origins, and reduces the impact of any injected markup.
- Configure cookies associated with authenticated sessions using HttpOnly and, as applicable, Secure and SameSite attributes so that even if XSS occurs, direct cookie access and cross-site attacks are harder to achieve.
How teams detect issues like this
Detection generally involves both code-centric and behavior-centric approaches:
- Static analysis and linting: Use rules that flag direct insertion of request parameters or user-controlled fields into HTML responses without sanitization or encoding, especially within core input-handling classes like the Request layer.
- Code review practices: During manual review, pay attention to any server-side logic that relies on client-side validation for security, or that passes raw or minimally processed user input into templates, HTML attributes, or script blocks.
- Template and rendering checks: Audit templates for any instances where escaping is disabled or bypassed, and ensure default-escape mechanisms are consistently applied.
- Security testing and fuzzing: Employ automated scanners or manual penetration testing that injects XSS test payloads into input fields and verifies whether they are reflected or stored and later executed when content is viewed.
- Policy enforcement: Integrate pre-commit or CI policies that disallow unsafe HTML rendering helpers or patterns, and require use of standardized sanitization/encoding utility functions.

