
Proof-of-concept and lab for CVE-2026-129358, a stored XSS in Magma NMS <=1.9.0 where unescaped organization names break out of the inline CONFIG script.
CONFIG script| CVE | CVE-2026-129358 (VDB-437421) |
| Component | Linux Foundation Magma NMS — nms/server/main/routes.ts (handleReact) + nms/server/views/index.pug (unescaped !{configJson}), name stored via nms/server/host/routes.ts (POST /host/organization/async) |
| Affected | Magma ≤ 1.9.0 (both files byte-identical in master; single commit since 2022) |
| Fixed in | nothing upstream at the time of this laboratory; the fixed side is a hash-checked synthetic remediation (documented as such) |
| CWE | CWE-79 (Cross-site Scripting, Stored) |
| Impact | Session/credential theft for every member of a poisoned organization: the stored organization name executes as script in members' browsers on /nms* and /settings |
| Vector | The organization name is stored with no validation by any caller able to create organizations (a host-org user, per the sibling CVE-2026-129357); members trigger execution by logging in |
| Trigger | organization name xss-</script><script>alert(document.cookie)</script> — served raw inside var CONFIG = … |
The React entrypoint of every NMS page embeds session and organization data as an inline script, and the template interpolates it UNESCAPED:
// nms/server/main/routes.ts, handleReact (tag v1.9.0)
configJson: JSON.stringify({appData}), // tenant = organization.name
res.render('index', {staticDist, configJson});
// nms/server/views/index.pug
var CONFIG = !{configJson};
JSON.stringify does not encode <, so an organization whose name
is xss-</script><script>alert(document.cookie)</script> closes the
script block and executes in every member's browser. The name is stored
with no validation by POST /host/organization/async (and persists in
the database — a stored payload).
This laboratory runs the real Magma NMS server (v1.9.0, the upstream
node/yarn build) with its real local auth over Postgres. The PoC
reproduces the publicly disclosed flow: the host-org admin creates the
poisoned organization with a custom domain, adds a member, the member
logs in and requests /nms/ — the payload's raw
</script><script> breakout is served to the member on the vulnerable
build; the remediated build escapes it (\u003c) so it cannot leave the
script context.
Two facts compose:
POST /host/organization/async
(nms/server/host/routes.ts) writes req.body.name straight into
the Organizations table;handleReact serializes the org
name into configJson, and index.pug's !{configJson} is Pug's
unescaped interpolation; JSON.stringify leaves < and >
untouched, so the string breaks out of the enclosing
<script>var CONFIG = …</script> block.Every member page of the poisoned organization (/nms*, /settings)
carries the executed payload — document.cookie is readable in that
origin (the session cookie is not HttpOnly-protected from script in
this rendering path in v1.9.0 configurations). The e-mail field is a
secondary carrier with the same sink; the organization name is the
published vector.
| service | image | role |
|---|---|---|
xss-vuln | cve-2026-129358:vuln | Magma v1.9.0 as released (upstream nms Docker build), standalone with its own Postgres |
xss-fixed | cve-2026-129358:fixed | the same tree with lab/patch-fixed.py (hash-checked): < > & and U+2028/U+2029 escaped in the serialized configJson at every serialization site |
xss-db-vuln / xss-db-fixed | postgres:9.5 | one per side, per the product's own compose topology |
poc | cve-2026-129358-poc:local | stdlib-only Python driver |
Seeded with the upstream setAdminPassword script (host org + admin
superuser). The PoC itself creates the poisoned organization (custom
domain pwned.localhost) and its member, mirroring the publicly
disclosed exploit. Environment adjustments documented in
evidence/versions.txt (standalone-NMS tenants shim applied equally to
both sides; dev-mode runtime for the plain-HTTP lab network).
./run-lab.sh build # upstream nms build at v1.9.0 (vuln + fixed trees)
./run-lab.sh up # cve129358lab network, two NMS+Postgres stacks
./run-lab.sh sweep # check / exploit / probe / mitigation on both sides
./run-lab.sh down
poc/poc.py (stdlib only; mirrors the publicly disclosed exploit flow):
/nms/ fetch,
classify RAW-SCRIPT vs ESCAPED. Exit 1 vulnerable, 0 safe, 3 no
worker, 2 unreachable.img onerror,
svg onload) × member pages.| run | xss-vuln (v1.9.0) | xss-fixed (synthetic) |
|---|---|---|
check victim fetches /nms/ | RAW-SCRIPT — tenant":"xss-</script><script>alert(document.cookie)… | ESCAPED — tenant":"xss-\u003c/script\u003e\u003cscript\u003e… |
exploit tenant field | raw breakout served | escaped, cannot leave the script block |
probe script breakout | RAW-SCRIPT | ESCAPED |
probe img onerror / svg onload | RAW-SCRIPT (in the rendered page) | ABSENT |
mitigation | RAW-SCRIPT | ESCAPED |
Captured runs: evidence/check-*-run.txt, evidence/exploit-*-run.txt,
evidence/probe-*-run.txt, evidence/mitigation-*-run.txt,
evidence/versions.txt, evidence/0day-sweep.txt.
cve129358lab network.The payload-variant matrix is the surface sweep
(evidence/0day-sweep.txt): all three XSS shapes render raw on the
shipped build; the remediation escapes the breakout and keeps the
tag-shaped variants out of the page entirely. The sibling privilege
escalation that lets a low-privilege host-org user create the poisoned
organization is CVE-2026-129357, reproduced in
CVE-2026-129357.
README.md this write-up
run-lab.sh environment driver (build / up / sweep / down)
Makefile convenience targets
poc/poc.py the PoC (check / exploit / probe / mitigation)
poc/Dockerfile runner image (python:3.12-alpine)
lab/lab.Dockerfile multi-stage build (magma v1.9.0 → nms image)
lab/patch-tenants-shim.py environment shim, applied to BOTH sides equally
lab/patch-fixed.py the hash-checked synthetic remediation (v3)
lab/entrypoint.sh migrations → admin → server
evidence/ captured runs of every mode on both sides
TRACKING.md excluded (working record)