GHSA-CFPF-HHXH-C8R6
Stored XSS in banners block via HTML entity decoding of sanitized banner content
CVSS:4.0/AV:N/AC:L/AT:N/PR:H/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-CFPF-HHXH-C8R6 divulgada · CVSS 4.8 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Impact
This is a stored Cross-Site Scripting (XSS) vulnerability in the global banners block (`modules/banners/blocks/global.banners.php`).
An administrator with rights on the Banners module can store HTML that executes JavaScript in the browser of every visitor who views a page containing the banners block.
Victims include anonymous visitors, logged-in users and higher-privileged administrators (general administrators and super administrators).
Because the admin panel is served from the same origin as the site, a script running in an administrator's browser can perform administrative actions with that administrator's session.
The banner content (`bannerhtml`) is correctly sanitized when it is saved: any markup that is not a valid, allowed tag is HTML-encoded (for example `<` becomes `<`).
However, the block calls `html_entity_decode()` on this already-sanitized value right before rendering it.
This reverses the encoding applied by the sanitizer and turns neutralized text back into live HTML, so the sanitization happens before the final decoding step and is bypassed.
Two example payloads, entered in the banner content editor:
- `<img src=x onerror=alert(1)` (a tag without a closing `>`), which the sanitizer stores as the text `<img src=x onerror=alert(1)`.
- The text `<img src=x onerror=alert(1)>` typed as plain text in the WYSIWYG editor, which the editor submits as `<img src=x onerror=alert(1)>`.
In both cases the stored value is harmless, but the block decodes it into a real `<img>` tag with an `onerror` handler and the script executes.
Exploitation requires an authenticated administrator account with rights on the Banners module.
Regular users submitting advertisements from the site (`addads`) cannot set banner HTML content and are not able to exploit this issue.
Patches
The vulnerability is fixed in NukeViet 4.6.03.
The fix removes the `html_entity_decode()` call so the block outputs the sanitized banner content exactly as stored.
The stored value is already filtered HTML, and the XML cache used by the block (DOMDocument / SimpleXML) preserves it without change, so no decoding is needed.
All versions from 4.1.01 up to and including 4.6.02 are affected.
Users should upgrade to 4.6.03 or later.
No data migration is required: existing banners are rendered safely as soon as the patched code is deployed.
Workarounds
If upgrading is not immediately possible, apply one of the following:
- Remove these lines from `modules/banners/blocks/global.banners.php`:
```php
if (!empty($banners['bannerhtml'])) {
$banners['bannerhtml'] = html_entity_decode($banners['bannerhtml'], ENT_COMPAT | ENT_HTML401, strtoupper($global_config['site_charset']));
}
```
- Grant rights on the Banners module only to fully trusted administrators.
- Remove the banners block from the site layout until the patch is applied.
To check for existing malicious content, review banners whose HTML content contains encoded markup, for example:
SELECT id, title, bannerhtml FROM nv4_banners_rows WHERE bannerhtml LIKE '%<%';Replace `nv4` with your database table prefix.
References
- Fix commit: https://github.com/nukeviet/nukeviet/commit/00c040806b54f50a963d6f4f1b1bb645ee260ccd
- CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'): https://cwe.mitre.org/data/definitions/79.html
- CWE-180: Incorrect Behavior Order: Validate Before Canonicalize: https://cwe.mitre.org/data/definitions/180.html
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
Packagistnukeviet/nukeviet |
Sin parche | — | — | — |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/nukeviet/nukeviet/security/advisories/GHSA-cfpf-hhxh-c8r6Las referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
