CVE-2026-31899
Python vulnerability analysis and mitigation

Overview

CVE-2026-31899 is an exponential Denial of Service vulnerability in CairoSVG caused by uncontrolled recursive processing of SVG <use> elements. It affects all versions of CairoSVG prior to 2.9.0 (i.e., <= 2.8.2) and was disclosed on March 13, 2026, by researcher Kai Aizen (SnailSploit). The vulnerability carries a CVSS v3.1 base score of 7.5 (High) (Github Advisory, CairoSVG Advisory). CairoSVG is a widely used Python library with approximately 300,000 downloads per week.

Technical details

The root cause is uncontrolled recursion (CWE-674) and improper restriction of recursive entity references (CWE-776) in the use() function within cairosvg/defs.py (around line 335). This function processes SVG <use> elements — which reference and re-render other SVG nodes — without any depth limit or total element budget, enabling exponential amplification: with 5 levels of nesting and 10 references per level, a 1,411-byte SVG input triggers 10^5 (100,000) render calls. The attack requires no authentication, no special privileges, and no user interaction — an attacker simply submits a crafted SVG file to any endpoint that passes it to CairoSVG for processing (CairoSVG Advisory, Github Advisory). A public PoC repository with the exact SVG payload and reproduction steps is available (SnailSploit PoC).

Impact

Successful exploitation causes the affected process to consume 100% CPU indefinitely while memory remains stable at approximately 43MB, meaning the process never terminates on its own and is not killed by OOM mechanisms. Any service that accepts SVG input and passes it to CairoSVG — including image thumbnailing pipelines, PDF generation services, and avatar rendering endpoints — is vulnerable to complete availability loss. There is no confidentiality or integrity impact; the sole consequence is a sustained denial of service that renders the affected service unresponsive to legitimate requests (CairoSVG Advisory, Github Advisory).

Exploitability

A functional proof-of-concept exploit is publicly available on GitHub, including the 1,411-byte SVG payload and step-by-step reproduction instructions (SnailSploit PoC). The vulnerability requires no authentication, no privileges, and no user interaction, making it trivially exploitable by any network-accessible attacker. As of the time of reporting, there is no evidence of active in-the-wild exploitation, and the CVE is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. The EPSS score is approximately 0.04% (12th percentile), indicating a currently low but non-negligible probability of exploitation (Github Advisory).

Exploitation steps

  1. Reconnaissance: Identify services that accept SVG file uploads or process SVG input using CairoSVG (e.g., image conversion APIs, avatar upload endpoints, PDF generation services). Check for Python/CairoSVG version indicators in HTTP headers, error messages, or open-source project dependencies.
  2. Craft the payload: Construct a malicious SVG file (approximately 1,411 bytes) containing 5 levels of nested <use> elements, each referencing 10 child elements, creating an O(10^N) amplification tree. The PoC payload is publicly available at SnailSploit PoC.
  3. Submit the payload: Upload or submit the crafted poc.svg to the target service's SVG-processing endpoint (e.g., a file upload form, API endpoint, or avatar upload feature).
  4. Trigger CPU exhaustion: CairoSVG's use() function in defs.py begins recursively processing the nested <use> elements without any depth or count limit, triggering 100,000+ render calls and pinning the server CPU at 100% indefinitely.
  5. Sustain the DoS: Repeat submissions if the process is externally killed or restarted, maintaining denial of service. Memory usage remains stable (~43MB), so the attack is sustainable without triggering OOM-based recovery (CairoSVG Advisory, SnailSploit PoC).

Indicators of compromise

  • Network: Repeated HTTP requests submitting small SVG files (around 1–2 KB) to image processing, PDF generation, or avatar upload endpoints; unusual volume of SVG upload requests from a single source IP.
  • Process: Python worker processes (e.g., python, gunicorn, uwsgi, celery) consuming 100% CPU for extended periods without completing; processes that never terminate after receiving an SVG input.
  • Logs: Application logs showing SVG conversion jobs that never complete or time out; absence of completion log entries for SVG processing tasks that were initiated; repeated job failures or worker restarts in task queue logs.
  • System: Sustained high CPU utilization on servers running CairoSVG-based services; system load average climbing without corresponding memory growth; worker process restart loops in process supervisors (e.g., systemd, supervisor).

Mitigation and workarounds

The primary remediation is to upgrade CairoSVG to version 2.9.0 or later, which introduces a hard limit of 100,000 referenced elements per render operation, aborting with a ValueError if exceeded (CairoSVG Commit). As interim workarounds, operators should implement input validation to reject oversized or structurally suspicious SVG files before they reach CairoSVG, apply rate limiting on SVG-processing endpoints, and enforce process-level timeouts (e.g., using signal.alarm() or external timeout wrappers) to kill hung rendering jobs. Monitoring CPU usage on SVG-processing services is recommended to detect exploitation attempts (Github Advisory, Red Hat Bugzilla).

Community reactions

Red Hat tracked the vulnerability via Bugzilla (Bug 2447447) and assessed it as high severity, with downstream package updates initiated for Fedora and RHEL ecosystems (Red Hat Bugzilla). SUSE and openSUSE issued security advisories and updated their python-cairosvg packages, and Mageia also released an advisory. Tenable published multiple Nessus detection plugins (IDs 302268, 306609, 306605, 307434) to identify vulnerable CairoSVG installations. The vulnerability received coverage from Linux security news outlets including linuxsecurity.com and pro-linux.de, reflecting broad awareness in the open-source ecosystem.

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Affected

bookworm

cairosvg

Affected

sid

cairosvg

Affected

trixie

cairosvg

Affected

Ubuntu

Unknown

bionic (esm-apps)

cairosvg

Unknown

devel

cairosvg

Unknown

focal (esm-apps)

cairosvg

Unknown

jammy

cairosvg

Unknown

jammy (esm-apps)

cairosvg

Unknown

noble

cairosvg

Unknown

noble (esm-apps)

cairosvg

Unknown

resolute

cairosvg

Unknown

Alpine

Fixed

edge

py3-cairosvg: 2.9.0-r0

Fixed

v3.23

py3-cairosvg: 2.9.0-r0

Fixed

SourceThis report was generated using AI

Related Python vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-59177HIGH8.8
  • Python logoPython
  • esphome-device-builder
NoYesSep 09, 2026
CVE-2026-88005MEDIUM6.5
  • Python logoPython
  • open-webui
NoYesSep 10, 2026
CVE-2026-88002MEDIUM6.5
  • Python logoPython
  • open-webui
NoYesSep 09, 2026
CVE-2026-88000MEDIUM6.5
  • Python logoPython
  • cpe:2.3:a:openwebui:open_webui
NoYesSep 09, 2026
CVE-2026-88001MEDIUM5
  • Python logoPython
  • open-webui
NoYesSep 09, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management