CVE-2026-83605
## Summary `Element.setAttribute()` in `@xmldom/xmldom` bypasses attribute name validation by calling the private `_createAttribute(name)` method, which performs no validation. The public `createAttribute()` method correctly validates names against an anchored `QName` pattern, but `setAttribute()` never uses it. The serializer escapes attribute *values* but trusts attribute *names*, allowing an attacker to inject additional attributes (including event handlers) into serialized output. The `requireWellFormed: true` option did not catch this. ## Details `Element.setAttribute(name, value)` creates attribute nodes by calling the private `_createAttribute(name)` method, which performs no validation on the `name` parameter. In contrast, the public `Document.createAttribute(name)` method validates the name against the `QName` production before creating the attribute node. The result is a two-tier validation system where the most commonly used API (`setAttribute`) takes the unvalidated path: - `doc.createAttribute("bad name")` — throws `INVALID_CHARACTER_ERR` (correct). - `el.setAttribute("bad name", "value")` — succeeds silently (vulnerable). The serializer emits attribute names verbatim into the output. Because attribute values ARE escaped (quotes, ampersands, etc.), the injection must occur through the name. An attacker can terminate the current attribute and inject new ones by including quote and space characters in the attribute name. ### Root Cause 1. `setAttribute()` calls `_createAttribute()` (private, no validation) instead of `createAttribute()` (public, validates against `QName`). 2. The serializer trusts attribute names and emits them unescaped. 3. The serializer's `requireWellFormed` code path did not validate attribute names during serialization. ## Proof of Concept ```js const { DOMImplementation, XMLSerializer } = require('@xmldom/xmldom'); const impl = new DOMImplementation(); const serializer = new XMLSerializer(); const doc = impl.createDocumen
Properties
- ghsa_id
- GHSA-4w3w-2rp5-g8jm
- summary
- xmldom: Attribute name injection via setAttribute() bypasses requireWellFormed
- severity
- high
- epss_score
- 0.00348
- cve_id
- CVE-2026-83605
- is_ghsa_only
- false
- ghsa_published
- 2026-09-08T20:30:51Z
- source_url
- https://github.com/advisories/GHSA-4w3w-2rp5-g8jm
- epss_percentile
- 0.27802
- ghsa_updated
- 2026-09-08T20:30:52Z
Related Entities (7)
ENRICHED_BY (1)
REPORTED_BY (1)
VULNERABLE_TO (2)
AFFECTS (2)
HAS_WEAKNESS (1)
Explore deeper with Ninja Signal's threat intelligence graph