{"id":"CVE-2026-94567","aliases":["CVE-2026-94567","GHSA-cp55-wmv6-wxpp"],"related":[],"kind":"vulnerability","state":"published","title":"NukeViet CMS: Stored XSS via SVG upload: the sanitizer is blind to markup hidden inside an internal DTD entity","summary":"NukeViet CMS is a multi Content Management System. Prior to 4.5.12 and 4.6.02, an attacker with access to an SVG upload flow can hide a script element in an internal DTD entity. NukeViet\\Files\\Upload::check_svg_tmpfile() loads the document without entity expansion, leaving a DOMEntityReference, and sanitize_svg_dom() inspects only element nodes, while browsers expand the entity when the stored file is served as image/svg+xml. The SVG path also returned before verify_image() and preserved the original bytes, so the hidden script reached disk unchanged. Guest comment attachments make the upload unauthenticated only when a module's comment feature is open to the All or Guest group and allowattachcomm is enabled; module administrators can also use the file manager, allowing same-origin script execution in an administrator's session. This issue is fixed in versions 4.5.12 and 4.6.02.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"NukeViet CMS is a multi Content Management System. Prior to 4.5.12 and 4.6.02, an attacker with access to an SVG upload flow can hide a script element in an internal DTD entity. NukeViet\\Files\\Upload::check_svg_tmpfile() loads the document without entity expansion, leaving a DOMEntityReference, and sanitize_svg_dom() inspects only element nodes, while browsers expand the entity when the stored file is served as image/svg+xml. The SVG path also returned before verify_image() and preserved the original bytes, so the hidden script reached disk unchanged. Guest comment attachments make the upload unauthenticated only when a module's comment feature is open to the All or Guest group and allowattachcomm is enabled; module administrators can also use the file manager, allowing same-origin script execution in an administrator's session. This issue is fixed in versions 4.5.12 and 4.6.02.","source":"cvelist"},{"lang":"en","text":"### Impact\n\nThis is a **stored cross-site scripting (XSS)** vulnerability. An uploaded SVG can carry a `<script>` element hidden inside an internal DTD entity; the server-side sanitizer never sees it, stores the file byte-for-byte, and serves it as `image/svg+xml`, so the script executes in the site's own origin when the file URL is opened in a browser.\n\nThe SVG sanitizer `sanitize_svg_dom()` enumerates elements with `DOMXPath::query('//*')` and rejects any tag outside an allow-list, so a plain scripted SVG is correctly blocked. The check is bypassed by declaring the script inside an internal DTD entity, because `DOMDocument` is loaded **without** `LIBXML_NOENT`; libxml therefore keeps the reference as a `DOMEntityReference` node (node type 5, not an element), `//*` never returns the `<script>`, and the file passes validation. Browsers parsing `image/svg+xml` do expand internal entities, so a real `<script>` element materialises client-side.\n\nA second defect turns the DOM walker into a single point of failure: for SVG uploads `check_tmpfile()` returns the result of `check_svg_tmpfile()` before ever calling `verify_image()`, so the raw-byte screen that greps for a literal `<script>` never runs on an SVG - its `if ($svg and preg_match(...))` branch is unreachable because no caller passes `$svg = true`. Finally, the admin upload handler skips all image re-processing when the file is an SVG, so the attacker's exact bytes are what land on disk.\n\nWho is impacted: any site running an affected version that accepts SVG uploads. The most severe entry point is **unauthenticated**: when a module's comment feature is opened to the \"All\" or \"Guest\" group (a standard, supported option for public sites) and comment attachments are enabled (`allowattachcomm`), a guest with no account can upload the SVG, because the default extension set includes the `images` group and the `images` group includes `svg`. The same applies to any front-end submission flow whose plan permits image uploads. In addition, the admin file manager (`nv=upload&op=upload`) is reachable by **any module admin** - site-admin is not required - which makes this also a privilege-escalation path from module admin to site admin. In all cases the stored file runs with the victim's session: sending the `/uploads/...svg` link to an administrator lets the payload run with that administrator's authority. There is no Content-Security-Policy and no `Content-Disposition` on the uploads directory to contain it (`X-Content-Type-Options: nosniff` does not stop `image/svg+xml` from executing script).\n\n### Details\n\nRoot cause is a parser-differential (CWE-436): the sanitizer and the browser interpret the same bytes differently. The sanitizer parses without entity expansion and sees only `<svg>` and `<rect>`; the browser expands `&payload;` into a live `<script>` element. Because the sanitized document is stored verbatim (no re-serialisation) and the raw-byte fallback is dead code for SVG, nothing else catches the smuggled markup.\n\nAffected code (package `vinades/nukeviet`, file `Files/Upload.php`):\n\n- `check_tmpfile()` returns `check_svg_tmpfile()` on the SVG path before reaching `verify_image()`.\n- `check_svg_tmpfile()` calls `$dom->load($tmp_name, LIBXML_NONET)` without `LIBXML_NOENT`, then walks the DOM with `//*`.\n- `verify_image()`'s `if ($svg and preg_match('#</*(applet|link|script|...)#'))` branch is never reached because both call sites use the default `$svg = false`.\n\n### Proof of concept\n\nPayload (`poc.svg`):\n\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE svg [\n  <!ENTITY payload \"<script>alert('XSS on '+document.domain)</script>\">\n]>\n<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"200\" height=\"200\" viewBox=\"0 0 200 200\">\n  <rect width=\"200\" height=\"200\" fill=\"#eee\"/>\n  &payload;\n</svg>\n```\n\n1. Upload the file through the admin file manager (`POST /admin/index.php?nv=upload&op=upload`, `type=image`) as any module admin, or via a front-end comment/banner attachment where enabled. It is accepted and stored unchanged.\n2. Control test: the identical script written as a plain `<script>` element is rejected - proving the entity, not \"SVG scripts are allowed\", is the bypass.\n3. Open `/uploads/<name>.svg` directly in a browser: the internal entity expands into a real `<script>` element and executes in the site's origin (confirmed reading `document.domain`).\n\n### Patches\n\nYes. Fixed in commit `b4abcddd3` on the `nukeviet4.6` branch; the change is listed in `CHANGELOG.txt` under NukeViet 4.6.02. Users should update to the release that contains this commit (NukeViet 4.6.02 or later). Because the vulnerable code lives in the `vinades/nukeviet` Composer package, sites that vendor it should also update the package, not only the CMS tree.\n\nThe fix, all inside `check_svg_tmpfile()`:\n\n1. Reject any SVG that declares a `DOCTYPE` (`$dom->doctype !== null`). SVGs used as site assets have no legitimate need for an internal DTD subset; this removes the ability to declare entities at all and also blocks XXE.\n2. Re-serialise the sanitised DOM back to disk (`saveXML()` + `file_put_contents()`), so what is stored equals what was validated (no smuggling via comments, CDATA, or trailing bytes).\n3. Restore the raw-byte defence-in-depth screen on the SVG path by calling `verify_image($tmp_name, true)`, reviving the previously dead `$svg = true` branch.\n\nA related compatibility fix was applied at the same time: the parse was switched from `DOMDocument::load($file)` to `file_get_contents()` + `DOMDocument::loadXML($content)`, because on PHP 7.x `libxml_disable_entity_loader(true)` makes `load()` unable to read the file (file I/O goes through the same entity loader that was just disabled), which caused all SVG uploads to fail. `loadXML()` takes the string directly and is not affected; the security posture is unchanged (no `LIBXML_NOENT`, no `LIBXML_DTDLOAD`, `LIBXML_NONET` set, entity loader still disabled on PHP 7.x), and XXE via a `SYSTEM` entity was verified not to leak file contents on PHP 7.4 / 8.2 / 8.5.\n\n### Workarounds\n\nFor users who cannot update immediately:\n\n- Remove `svg` from the allowed upload types - in the admin upload configuration and in the extension groups used by comment attachments and banner plans (the `images` group in `includes/ini/mime.ini` contains `svg`).\n- Serve the uploads directory with `Content-Disposition: attachment` for `.svg` files and/or a restrictive `Content-Security-Policy`, so SVGs are downloaded rather than rendered inline and any script is contained.\n- Restrict who can upload: disable front-end comment/banner attachments (`allowattachcomm` and banner upload plans) and review which accounts hold module-admin rights.","format":"markdown","source":"ghsa"}],"published":"2026-11-20T18:57:15.602Z","modified":"2026-11-30T21:15:12.127Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N","score":9.3,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N","score":9.3,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:N","score":9.3,"rating":"CRITICAL"}],"cwes":["CWE-79","CWE-434","CWE-436"],"affected":[{"ranges":[{"version":"< 4.5.12","status":"affected"},{"version":">= 4.6.00, < 4.6.02","status":"affected"}],"vendor":"nukeviet","product":"nukeviet","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"4.5.12"}],"ecosystem":"Packagist","package":"nukeviet/nukeviet","purl":"pkg:composer/nukeviet/nukeviet","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"4.6.00","status":"affected"}],"ecosystem":"Packagist","package":"nukeviet/nukeviet","purl":"pkg:composer/nukeviet/nukeviet","source":"ghsa"}],"references":[{"url":"https://github.com/nukeviet/nukeviet/security/advisories/GHSA-cp55-wmv6-wxpp","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nukeviet/nukeviet/commit/912823e2581afc23dc39dabdb7d94c718efc78f6","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nukeviet/nukeviet/commit/b4abcddd3a3a628e251d88571f3968822fab4406","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nukeviet/nukeviet/blob/4.5.13/CHANGELOG.txt","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/nukeviet/nukeviet/releases/tag/4.6.02","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nukeviet.vn/vi/news/Tin-tuc/thong-bao-phat-hanh-nukeviet-4-6-02-858.html","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-94567","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/nukeviet/nukeviet","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-11-20T19:15:37.195Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-94567","url":"https://www.cve.org/CVERecord?id=CVE-2026-94567","licence":"CVE Terms of Use","modified":"2026-11-20T19:16:18.527Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-cp55-wmv6-wxpp","url":"https://github.com/advisories/GHSA-cp55-wmv6-wxpp","licence":"CC-BY-4.0","modified":"2026-11-30T21:15:12.127Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-94567","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-94567","licence":"Public domain","modified":"2026-11-20T20:17:51.233Z"}],"updatedAt":"2026-11-30T21:27:25.185Z","epss":{"score":0.00881,"percentile":0.60193,"date":"2026-12-01T12:00:22.000Z"}}