VAITP Dataset

← Back to the dataset

CVE-2026-114610

Exponential CPU/memory blowup via nested SVG <use> in fpdf2 (2.5.0‑2.8.8).

  • CVSS 6.5
  • CWE-400
  • Resource Management
  • Remote

fpdf2 is a PDF creation library for Python. From 2.5.0 until 2.8.8, fpdf2's SVGObject.build_xref() passes nested SVG <use> references to GraphicsContext.add_item(), whose default clone=True deep-copy behavior copies the complete referenced graphics tree during FPDF.image() processing. Repeating references at each nesting level makes the in-memory object count and processing work grow exponentially, allowing a small user-controlled SVG to consume excessive CPU and memory, raise MemoryError, fail PDF generation jobs, and reduce or exhaust worker capacity. ResourceAccessPolicy does not prevent the issue because the references are inline and require no external resource, XML entity, local file, or permissive network setting. This issue is fixed in version 2.8.8.

CVSS base score
6.5
Published
2026-10-22
OWASP
A04 Insecure Design
Orthogonal defect classification
Algorithm
Code defect classification
Incorrect Algorithm
Category
Resource Management
Subcategory
Resource Exhaustion
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
fpdf2
Fixed by upgrading
Yes

Solution

Upgrade fpdf2 to version 2.8.8 or later.

Vulnerable code sample

from fpdf import FPDF
from fpdf.svg import SVGObject

def add_svg(pdf: FPDF, svg_path: str):
    # VULNERABLE: deep copy of nested <use> elements causes exponential resource use
    with open(svg_path, "r", encoding="utf-8") as f:
        svg = SVGObject(f.read())
    # The library internally calls GraphicsContext.add_item(item, clone=True)
    pdf._doc.graphics_context.add_item(svg, clone=True)

def build_pdf(svg_path: str, out_path: str):
    pdf = FPDF()
    pdf.add_page()
    add_svg(pdf, svg_path)
    pdf.output(out_path)

Patched code sample

from fpdf import FPDF
from fpdf.svg import SVGObject

def add_svg(pdf: FPDF, svg_path: str):
    # FIX: disable deep copy to prevent exponential growth
    with open(svg_path, "r", encoding="utf-8") as f:
        svg = SVGObject(f.read())
    # Use clone=False so the graphics tree is shared, not duplicated
    pdf._doc.graphics_context.add_item(svg, clone=False)

def build_pdf(svg_path: str, out_path: str):
    pdf = FPDF()
    pdf.add_page()
    add_svg(pdf, svg_path)
    pdf.output(out_path)

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

  • Add SVG complexity limits (#1889) (py-pdf/fpdf2)
    fpdf/errors.py, fpdf/fpdf.py, fpdf/fpdf.py · FPDF.image, fpdf/fpdf.py · FPDF.preload_glyph_image, fpdf/fpdf.py · FPDF.preload_image, fpdf/fpdf.py · FPDF.__init__, fpdf/image_parsing.py, fpdf/image_parsing.py · get_svg_info, fpdf/image_parsing.py · preload_image, fpdf/svg.py, fpdf/svg.py · SVGImage.render, fpdf/svg.py · SVGObject.build_clipping_path and 9 more

Cite this entry

@misc{vaitp:cve2026114610,
  title        = {{Exponential CPU/memory blowup via nested SVG <use> in fpdf2 (2.5.0‑2.8.8).}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-114610},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-114610/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.