fix(security): update vulnerability-updates [security]#1400
Merged
Conversation
✅ Deploy Preview for openfeature ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR contains the following updates:
3.4.10→3.4.114.1.1→4.2.0DOMPurify: Permanent
ALLOWED_ATTRpollution viasetConfig()bypassing the hook clone-guard (incomplete fix of the 3.4.7 hook-pollution patch)GHSA-cmwh-pvxp-8882
More information
Details
Summary
DOMPurify 3.4.7 shipped a security fix ("permanent hook pollution") that makes a registered
uponSanitizeAttributehook's mutation ofdata.allowedAttributesnon-persistent — so allowing an attribute for one element does not leak into latersanitize()calls. The fix clonesALLOWED_ATTRinside_parseConfig.That guard is silently bypassed whenever the application uses the persistent-config API
DOMPurify.setConfig().setConfig()sets the module flagSET_CONFIG = true, which causessanitize()to skip_parseConfigentirely — and the clone-guard lives inside_parseConfig. The hook is then handed the live, sharedALLOWED_ATTRobject; anydata.allowedAttributes[name] = trueit writes mutates that shared object permanently, for the lifetime of the DOMPurify instance, across every subsequent call, and across all elements.If an application uses
setConfig()together with anuponSanitizeAttributehook that conditionally allows a dangerous attribute (onerror,onclick,onmouseover,srcdoc,formaction, …) for "trusted" elements, then one trusted render permanently allows that attribute on untrusted, attacker-controlled content — yielding stored XSS in viewers' browsers. DOMPurify applies no separate/^on/event-handler blocklist: attribute stripping is governed entirely by the allowlist, so a polluted allowlist is the only gate, and survival in the output is final.Affected configuration (preconditions)
The vulnerability is triggered when an application does both:
DOMPurify.setConfig(...)once (the recommended pattern for a fixed, persistent policy), anduponSanitizeAttributehook that writesdata.allowedAttributes[name] = trueto conditionally allow an attribute (e.g. only for elements bearing a trust marker).This hook pattern is demonstrated in DOMPurify's own test suite, and the per-call variant of exactly this leak is what 3.4.7 was released to fix.
Root cause (source:
src/purify.ts, v3.4.10)The 3.4.7 clone-guard — only inside
_parseConfig:sanitize()skips_parseConfigon the persistent-config path:setConfig()sets the flag that disables the guard:The hook is handed the live allowlist binding, and there is no secondary event-handler defense:
Net: after
setConfig(), the clone-guard never runs, so the hook'sallowedAttributesmutation is a permanent write to the instance's sharedALLOWED_ATTR.Proof of Concept
Environment:
npm i dompurify@3.4.10 jsdom(Node; identical mechanism toisomorphic-dompurify, and to a browser instance).PoC 1 — the leak (trusted render permanently allows
onerroron attacker content)PoC 2 — it is a DOMPurify state-leak, not "the app allowed
on*" (attribute-agnostic)PoC 3 — control: WITHOUT
setConfig()the 3.4.7 guard holdsPersistence (observed)
removeAllHooks()— removing the hook does not clean the polluted allowlist.onmouseoversurvives on<a>and<div>, not only the originally-blessed<img>.clearConfig()does restore a clean state (this is the bound of the impact).Impact
Stored XSS. In a long-lived (e.g. server-side /
isomorphic-dompurify) DOMPurify instance, a single trusted render flips a shared allowlist bit; every subsequent untrusted submission then inherits a live event-handler attribute and executes script in viewers' browsers. Because DOMPurify enforces no/^on/blocklist, a survivingon*attribute is final — no secondary control prevents execution.onerroron a broken-src<img>fires with no user interaction (browser-confirmed; see Validation).Per-call
FORBID_ATTRdoes not mitigate. A defensivesanitize(input, { FORBID_ATTR: ['onerror'] })is also ignored oncesetConfig()has been called: the per-call config is parsed by_parseConfig, whichsanitize()skips entirely underSET_CONFIG. So an application cannot blunt the leak with a per-call denylist — the poisonedALLOWED_ATTRis the sole gate.Realistic attack scenario
A platform mixes admin-authored interactive widgets with user-generated content through one sanitizer instance:
setConfig({ ALLOWED_TAGS: [...], ALLOWED_ATTR: [...] }).uponSanitizeAttributehook that enables an event handler only for admin-vetted elements markeddata-trusted="1", intending safe rich interactivity — a pattern the 3.4.7 fix was specifically meant to make safe.<img src=x onerror=...>passes sanitization and executes for all viewers.Remediation
Extend the existing clone-guard to the persistent-config (
SET_CONFIG) fast-path: whensanitize()skips_parseConfigbut anuponSanitizeAttributehook is registered, clone the allowlists before the walk so hook mutations cannot persist — the exact analogue of the guard already present in_parseConfig.(Equivalently: in the hook-event builder at line ~2088, hand the hook a shallow clone of
ALLOWED_ATTR/ALLOWED_TAGSwheneverSET_CONFIGis true, mirroring the 3.4.7 intent.)A regression test should reproduce PoC 1 and assert the attacker call returns
<img src="x">. Note the existing 3.4.7 regression test ("unguarded attribute hook does not poison subsequent default-config calls") never exercisessetConfig()— adding asetConfigvariant closes the gap.Application-side mitigation until patched: prefer
data.keepAttr = true(per-element, non-persistent) overdata.allowedAttributes[name] = trueinside hooks; or callDOMPurify.clearConfig()between trust domains; or use separate DOMPurify instances for trusted vs. untrusted content.Limitations
setConfig()and a hook writingdata.allowedAttributes[...]). Not a default-config bypass.clearConfig(), which restores a clean state. The earlier-considered "survivesclearConfig()" claim did not reproduce and is withdrawn.data.keepAttr=true, notallowedAttributes[]." However, the 3.4.7 security fix exists precisely to defend theallowedAttributes[]hook pattern in the per-call path; leaving thesetConfigpath unguarded is an incomplete fix of an acknowledged security issue.Validation
dompurify@3.4.10dist/purify.cjs.js(md5ab0e7b1cde1cbcace0f62b6aac284143) and browserdist/purify.min.js(md5b0985f80fa48e6e7b263f8f6a64b779e) are byte-identical to a freshlynpm pack-ed release — the repro is on the real shipped code. Mechanism identical on 3.4.0, 3.4.9 and 3.4.10.DOMPurify.isValidAttribute('img','onerror','x')flipsfalse → trueafter a single trusted render undersetConfig(), proving the shared attribute gate is poisoned. Leak survivesremoveAllHooks(), is cross-element, persists for the instance lifetime, and is reset only byclearConfig().innerHTMLexecutes the survivingonerror(sentinelwindow.__fired = ["ATTACKER-onerror"];onerrorDOM property is afunction), with no user interaction. The no-setConfigA/B control does not fire — execution is attributable to thesetConfigleak, not a harness artifact.Appendix A — Node PoC (complete, runnable)
Expected output:
Appendix B — Browser PoC (complete; confirms execution)
Observed:
handlers fired: ["alert:XSS:<domain>"]→ RESULT: XSS EXECUTED (no user interaction). The same harness without thesetConfig()line stripsonerrorand does not fire.Severity
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:NReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
JS-YAML: Quadratic-complexity DoS in merge key handling via repeated aliases
CVE-2026-53550 / GHSA-h67p-54hq-rp68
More information
Details
Summary
A crafted YAML document can trigger algorithmic CPU exhaustion in
js-yamlmerge-key processing (<<) by repeating the same alias many times in a merge sequence.This causes quadratic parse-time behavior relative to input size and can block a Node.js worker/event loop for seconds with a relatively small payload (tens of KB), resulting in denial of service.
Details
The issue is in merge handling inside
lib/loader.js:storeMappingPair(...)iterates every element of a merge sequence when key tag istag:yaml.org,2002:merge.mergeMappings(...).mergeMappings(...)computesObject.keys(source)and performs_hasOwnProperty.call(destination, key)checks for each key.When input is of the form:
a: &a {k0:0, k1:0, ..., kK:0}
b: {<<: [*a, *a, *a, ... repeated M times ...]}
all *a entries refer to the same anchored object. After the first merge, subsequent merges are semantically no-ops, but the parser still reprocesses all keys each time.
Resulting work is O(K * M), while input size is O(K + M), giving quadratic scaling as payload grows.
Relevant code path:
lib/loader.js in storeMappingPair(...) merge branch (keyTag === 'tag:yaml.org,2002:merge')
lib/loader.js mergeMappings(...)
Root cause
File: lib/loader.js
Function: storeMappingPair(state, _result, overridableKeys, keyTag, keyNode,
valueNode, startLine, startLineStart, startPos)
Lines: ~359-366
When the merge value is a sequence (YAML 1.1 <<: [ *a, *a, ... ]), each element
is handed to mergeMappings() without deduplication. mergeMappings() then does
Every alias reference in the sequence resolves (by design) to the SAME object
via state.anchorMap. After the first merge, every subsequent merge of that same
reference is a pure no-op semantically, but still performs:
Total: M * K hasOwnProperty checks + M Object.keys allocations, while the final
object and all observable side effects are identical to a single merge.
YAML semantics for
<<:are idempotent and commutative over duplicate sources,so collapsing duplicates preserves behavior exactly; this isn't a spec trade-off.
PoC
Environment:
js-yaml version: 4.1.1
Node.js: v24.5.0
Platform: arm64 macOS (reproduced consistently)
Reproduction script:
Create many keys in one anchored map (&a).
Merge that same alias repeatedly via <<: [*a, *a, ...].
Measure parse time and compare with control payload using single merge (<<: *a).
Observed repeated runs (same machine):
K=M=1000, input 9,909 bytes: ~33–36 ms
K=M=2000, input 20,909 bytes: ~121–123 ms
K=M=4000, input 42,909 bytes: ~524–537 ms
K=M=6000, input 64,909 bytes: ~1,608–1,829 ms
K=M=8000, input 86,909 bytes: ~3,395–3,565 ms
Control (single merge, similar key counts):
K=2000: ~1–2 ms
K=4000: ~3 ms
K=8000: ~5 ms
Also verified: repeated-merge output equals single-merge output (same key count and same JSON), confirming excess time is redundant computation.
Impact
This is a denial-of-service vulnerability (CPU exhaustion / algorithmic complexity).
Any service parsing untrusted YAML with js-yaml can be impacted, including API backends, CI tools, config processors, and automation services. An attacker can submit crafted YAML to significantly increase CPU time and reduce availability.
Suggested fix:
Dedupe the merge source list by reference before invoking mergeMappings. Any of
the following are minimal and preserve YAML 1.1 merge semantics:
dedupe in storeMappingPair:
Severity
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:LReferences
This data is provided by the GitHub Advisory Database (CC-BY 4.0).
Release Notes
cure53/DOMPurify (dompurify)
v3.4.11: DOMPurify 3.4.11Compare Source
setConfig, thanks @trace37labsnpm auditosv-scannersuppression list as no vulnerable dependencies are left for nownodeca/js-yaml (js-yaml)
v4.2.0Compare Source
Added
docs/safety.mdwith notes about processing untrusted YAML.maxDepth(100) loader option. Not a problem, but gives a betterexception instead of RangeError on stack overflow.
maxMergeSeqLength(20) loader option. Not a problem aftermergefix,but an additional restriction for safety.
dist/builds.Changed
dist/files are no longer kept in the repository.Fixed
Security
elements (makes sense for malformed files > 10K).
Configuration
📅 Schedule: (UTC)
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
👻 Immortal: This PR will be recreated if closed unmerged. Get config help if that's undesired.
This PR was generated by Mend Renovate. View the repository job log.