GitHub advisory · Packagist
NukeViet CMS: Unauthenticated Stored XSS in the Contact Module
Description
A stored-XSS vulnerability in the Contact module allows any unauthenticated user to inject malicious Javascript.
NukeViet's central input filter (NukeViet\Core\Request::filterTags), applied to virtually all POST data, is a denylist HTML sanitizer. Its most important rule strips any attribute whose name matches /^on/i (event handlers). This rule is bypassable through an HTML parser differential: the filter tokenizes a tag's attributes by splitting on ASCII space (0x20) only, whereas browsers also separate attributes on /. By inserting a / immediately before an event-handler name, the attacker makes the filter read the attribute name as /onerror — which does not start with on, so the denylist misses it — while the browser parses it as onerror and fires it.
The payload survives the entire filter chain unmodified and is stored and served raw (no output encoding) into the administration panel, which sends no Content-Security-Policy:
INPUT : <img src=x /onerror=alert(document.domain)>
STORED : <img src="x" /onerror="alert(document.domain)" />
ADMIN : <td colspan="2"><img src="x" /onerror="alert(document.domain)" /></td>
Because the handler executes in the same origin as the admin panel, an unauthenticated attacker who submits a crafted contact message obtains arbitrary JavaScript execution in the session of any administrator who opens it — enabling administrator account takeover.
<img src=x /onerror=alert(document.domain)>
alert(document.domain) displays the site's real origin (e.g. the target host), proving same-origin execution.
/contact/; set the message field to the payload above.status: ok).Manual fix · Packagist
composer require "nukeviet/nukeviet:^4.6.01"Sources