Inefficient Algorithmic Complexity Affecting enshrined/svg-sanitize package, versions >=0.5.3, <1.1.0


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.35% (30th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PHP-ENSHRINEDSVGSANITIZE-22193078
  • published4 Nov 2026
  • disclosed27 Oct 2026
  • creditAlpet Gexha

Introduced: 27 Oct 2026

NewCVE-2026-117540  (opens in a new tab)
CWE-407  (opens in a new tab)

How to fix?

Upgrade enshrined/svg-sanitize to version 1.1.0 or higher.

Overview

enshrined/svg-sanitize is a SVG sanitizer for PHP

Affected versions of this package are vulnerable to Inefficient Algorithmic Complexity via a quadratic-complexity code path in the sanitize() function when processing SVG input containing repeated PHP processing-instruction sequences. An attacker can submit a few-hundred-kilobyte upload that causes processing time to scale quadratically with input size, tying up a worker for tens of seconds and exhausting the worker pool with a handful of concurrent requests.

PoC

Generator emits `str_repeat('<?p', N) . '<?phpX?>' . str_repeat('hpY?>', N)` followed by a valid `<svg>`:

Measured end-to-end `sanitize()` time (default config):

| input size | time |
|-----------:|------|
| 32 KB | 0.16 s |
| 64 KB | 0.65 s |
| 128 KB | 2.48 s |
| 256 KB | 9.96 s |
| 384 KB | 22.2 s |

Doubling the input ~quadruples the time — textbook quadratic. A few-hundred-KB upload ties up a worker for tens of seconds; a few MB scales to minutes (input length is not bounded by the library, and because this is pre-parse string work, `allowHugeFiles` is irrelevant). A handful of concurrent requests exhausts the worker pool. No auth, no interaction, default config.

Note: The PoC states no specific environment, operating system, or non-default configuration.

CVSS Base Scores

version 4.0
version 3.1