CVE-2026-31017 Overview
CVE-2026-31017 is a Server-Side Request Forgery (SSRF) vulnerability in the Print Format functionality of ERPNext v16.0.1 and Frappe Framework v16.1.1. The flaw stems from insufficient sanitization of user-supplied HTML before it is rendered into PDF documents. The PDF rendering engine automatically resolves external resources referenced through HTML elements such as <iframe>, causing the server to issue arbitrary outbound HTTP requests. Attackers can abuse this behavior to reach internal services, including cloud metadata endpoints, and exfiltrate sensitive data. The vulnerability is categorized under CWE-918.
Critical Impact
Unauthenticated attackers can coerce ERPNext servers into making arbitrary internal HTTP requests, exposing cloud metadata credentials and internal service responses.
Affected Products
- Frappe ERPNext 16.0.1
- Frappe Framework 16.1.1
- Deployments rendering user-controlled HTML through Print Format to PDF
Discovery Timeline
- 2026-04-08 - CVE-2026-31017 published to NVD
- 2026-04-14 - Last updated in NVD database
Technical Details for CVE-2026-31017
Vulnerability Analysis
ERPNext's Print Format feature converts HTML templates into PDF documents through a server-side rendering engine. The application accepts HTML controlled by authenticated or guest-facing workflows and passes it to the PDF generator without stripping resource-loading elements. When the renderer encounters tags such as <iframe>, <img>, or similar external references, it issues HTTP requests from the server to fetch the embedded content. Attackers control both the target URL and the request initiation, satisfying the conditions for SSRF.
This behavior allows requests to reach hosts that are otherwise unreachable from the public internet. Cloud metadata services on AWS, Azure, and GCP respond to unauthenticated HTTP requests originating from the instance itself. The response content can be embedded back into the generated PDF or returned through error channels, enabling sensitive information disclosure.
Root Cause
The root cause is missing allowlist-based sanitization of HTML passed to the PDF rendering pipeline. The application trusts client-supplied markup and does not enforce a restricted subset of safe HTML elements. The PDF engine treats external URL references as a normal feature, with no network egress controls applied at the rendering layer.
Attack Vector
An attacker submits a crafted Print Format or document containing HTML that references an attacker-chosen URL through an embedded resource tag. When the server renders the document to PDF, it performs an outbound HTTP request to that URL. The attacker can target loopback interfaces, RFC1918 ranges, or cloud metadata endpoints such as http://169.254.169.254/latest/meta-data/. Retrieved data, including IAM credentials, may surface inside the rendered PDF. No user interaction is required beyond triggering the print or PDF generation workflow. Technical proof-of-concept details are published in the GitHub CVE-2026-31017 Repository.
Detection Methods for CVE-2026-31017
Indicators of Compromise
- Outbound HTTP requests from ERPNext application servers to 169.254.169.254, 127.0.0.1, or internal RFC1918 addresses originating from the PDF rendering process.
- Print Format records or document templates containing <iframe>, <object>, or external <img> tags referencing non-asset hosts.
- Generated PDFs that embed unexpected metadata strings, IAM credential fragments, or internal service banners.
- Spikes in PDF generation activity correlated with anomalous DNS lookups for attacker-controlled domains.
Detection Strategies
- Inspect Frappe and ERPNext application logs for Print Format submissions containing URL-loading HTML elements.
- Monitor egress traffic from ERPNext hosts and alert on connections to metadata IP ranges or non-business destinations.
- Compare baseline Print Format templates against current versions to identify unauthorized modifications introducing external references.
Monitoring Recommendations
- Enable web application firewall (WAF) logging on /api/method/frappe.utils.print_format and related PDF endpoints.
- Capture process-level network telemetry from wkhtmltopdf, Chromium, or other rendering binaries invoked by Frappe.
- Configure cloud provider audit logs to flag IMDS access patterns from application servers running ERPNext.
How to Mitigate CVE-2026-31017
Immediate Actions Required
- Upgrade ERPNext and Frappe Framework to fixed versions once published by the vendor on frappe.com.
- Restrict outbound network access from ERPNext servers to only required destinations using host firewalls or security groups.
- Enforce IMDSv2 with hop-limit 1 on AWS instances to block SSRF-based metadata credential theft.
- Audit existing Print Format templates and remove any HTML elements that load external resources.
Patch Information
No vendor advisory URL is currently listed in NVD. Administrators should monitor the Frappe Official Website and the project's GitHub release notes for patched releases superseding ERPNext 16.0.1 and Frappe Framework 16.1.1. Apply the security update across all production, staging, and development environments.
Workarounds
- Configure the PDF renderer to disable loading of external resources, scripts, and iframes where supported.
- Apply an egress proxy that denies HTTP requests to loopback, link-local, and private IP ranges from rendering hosts.
- Sanitize Print Format HTML server-side using an allowlist that excludes <iframe>, <object>, <embed>, and external <img> references.
- Restrict Print Format edit permissions to trusted administrative roles only.
# Example iptables egress restriction blocking cloud metadata access
iptables -A OUTPUT -d 169.254.169.254 -j REJECT
iptables -A OUTPUT -d 127.0.0.0/8 ! -o lo -j REJECT
iptables -A OUTPUT -d 10.0.0.0/8 -p tcp --dport 80 -j REJECT
iptables -A OUTPUT -d 172.16.0.0/12 -p tcp --dport 80 -j REJECT
iptables -A OUTPUT -d 192.168.0.0/16 -p tcp --dport 80 -j REJECT
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

