Skip to content

← Public intelligence

PyPI package

cairosvg

Open actionable advisories and recorded vendor fixes. This public package view has no inventory attached and cannot establish whether your deployment is affected. A vendor fix never resolves your finding; verify your installed version and the source guidance.

Open advisories

4 actionable advisories, newest first. Withdrawn advisories and news are excluded. Coverage is partial.

  1. High, CVSS 8.7PyPIAmendedPublished

    CairoSVG: Quadratic-time DoS parsing a crafted SVG

    CVE-2026-107378 · GHSA-c3jg-qh8m-j3h2

    Affected
    • PyPI cairosvg <= 2.9.0
    Fixed in
    2.9.1· Vendor fix available
    Issue
    Rendering an untrusted SVG whose <path d="..." contains many segments is O(n²) CPU. A single <path under 1 MiB burns tens of seconds. Two independent O(n²) sites in cairosvg/path.py: 1. Tokenizer — the path-data parser consumes the d string with a while string: loop that repeatedly slices/re-scans the remaining string (each step is O(len remaining)), giving O(n²) over the whole attribute. 2. drawmarkers — marker handling drains node.vertices with while node.vertices: ... node.vertices.pop(0); list.pop(0) is O(n), so draining n vertices is O(n²). Both are hit on a normal render path (svg2png/svg2pdf), attacker controls only the SVG document. PoC (installed cairosvg 2.9.0) | path segments | SVG size | time | |---|---|---| | 50,000 | 244 KB | 1.14 s | | 100,000 | 488 KB | 4.36 s | | 200,000 | ~960 KB | ~18 s | Doubling segments ≈ 4× time ⇒ quadratic. Sub-MiB input ⇒ ~18 s CPU; any service rendering user-supplied SVG (thumbnails, avatars, PDF export) is a DoS target. Reachability…

    Recommended action: Upgrade to 2.9.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.com (1)osv.dev (2)Source checked Evidence →
  2. High, CVSS 7.5PyPIAmendedPublished

    CairoSVG vulnerable to Exponential DoS via recursive element amplification

    CVE-2026-31899 · GHSA-f38f-5xpm-9r7c

    Affected
    • PyPI cairosvg <= 2.8.2
    Fixed in
    2.9.0· Vendor fix available
    Issue
    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: Expected: timeout kills the process after 10 seconds (it never completes on its…

    Recommended action: Upgrade to 2.9.0 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  3. High, CVSS 7.8PyPIAmendedPublished

    CairoSVG improperly processes SVG files loaded from external resources

    CVE-2023-27586 · GHSA-rwmf-w63j-p7gv

    Affected
    • PyPI cairosvg < 2.7.0
    Fixed in
    2.7.0· Vendor fix available
    Issue
    SSRF vulnerability Summary When CairoSVG processes an SVG file, it can make requests to the inner host and different outside hosts. Operating system, version and so on Linux, Debian (Buster) LTS core 5.10 / Parrot OS 5.1 (Electro Ara), python 3.9 Tested CairoSVG version 2.6.0 Details A specially crafted SVG file that loads an external resource from a URL. Remote attackers could exploit this vulnerability to cause a scan of an organization's internal resources or a DDOS attack on external resources. It looks like this bug can affect websites and cause request forgery on the server. PoC 1. Generating malicious svg file: 1.1 CairoSVGexploit.svg: 1.2 CairoSVGexploit2.svg: 1.3 CairoSVGexploit3.svg: 2. Run some commands: $ python3 -m cairosvg CairoSVGexploit.svg -f png $ python3 -m cairosvg CairoSVGexploit2.svg -f png $ python3 -m cairosvg CairoSVGexploit3.svg -f png 3. See result requests in Burp Collaborator: DOS vulnerability with SSTI Summary When CairoSVG processes an SVG file, it can…

    Recommended action: Upgrade to 2.7.0 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  4. High, CVSS 7.7PyPIAmendedPublished

    Regular Expression Denial of Service in CairoSVG

    CVE-2021-21236 · GHSA-hq37-853p-g5cf

    Affected
    • PyPI cairosvg < 2.5.1
    Fixed in
    2.5.1· Vendor fix available
    Issue
    Doyensec Vulnerability Advisory Regular Expression Denial of Service (REDoS) in cairosvg Affected Product: CairoSVG v2.0.0+ Vendor: https://github.com/Kozea Severity: Medium Vulnerability Class: Denial of Service Author(s): Ben Caller (Doyensec) Summary When processing SVG files, the python package CairoSVG uses two regular expressions which are vulnerable to Regular Expression Denial of Service (REDoS). If an attacker provides a malicious SVG, it can make cairosvg get stuck processing the file for a very long time. Technical description The vulnerable regular expressions are https://github.com/Kozea/CairoSVG/blob/9c4a982b9a021280ad90e89707eacc1d114e4ac4/cairosvg/colors.py#L190-L191 The section between 'rgb(' and the final ')' contains multiple overlapping groups. Since all three infinitely repeating groups accept spaces, a long string of spaces causes catastrophic backtracking when it is not followed by a closing parenthesis. The complexity is cubic, so doubling the length of the…

    Recommended action: Upgrade to 2.5.1 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →