Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB
CVE-2024-58391 Overview
CVE-2024-58391 is a reflected cross-site scripting (XSS) vulnerability in the Frappe framework. The flaw exists in the printview component, where URL parameters are rendered without proper output escaping. A remote attacker can craft a malicious printview URL that injects HTML and executes arbitrary JavaScript in the victim's browser session when the link is visited. The issue affects Frappe versions prior to 14.58.0 and 15.x versions prior to 15.4.0. Exploitation requires user interaction, specifically a victim clicking the attacker-supplied link while authenticated to a vulnerable Frappe instance. The weakness is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation).
Critical Impact
Successful exploitation enables session hijacking, credential theft, and actions performed in the context of the authenticated victim, including administrative users of ERPNext deployments built on Frappe.
Affected Products
- Frappe Framework versions prior to 14.58.0
- Frappe Framework 15.x versions prior to 15.4.0
- Downstream applications built on vulnerable Frappe versions (including ERPNext deployments)
Discovery Timeline
- 2026-10-12 - CVE-2024-58391 published to NVD
- 2026-10-13 - Last updated in NVD database
Technical Details for CVE-2024-58391
Vulnerability Analysis
Frappe is an open-source, full-stack web application framework written in Python and JavaScript, best known as the foundation for the ERPNext business suite. The printview feature renders document previews suitable for printing and accepts parameters through the request URL to control formatting and content selection.
The vulnerability stems from the server rendering printview parameters directly into the response HTML without applying output encoding. An attacker can place HTML markup and <script> payloads into one of these parameters. When a victim loads the crafted URL, the injected markup becomes part of the rendered page and executes in the origin of the Frappe application.
Because the payload runs under the application's origin, it can read session cookies that are not marked HttpOnly, issue authenticated requests through the Frappe REST API, modify documents, exfiltrate data, or escalate to administrator-level actions if the victim holds that role.
Root Cause
The root cause is missing contextual output escaping in the printview rendering path. User-controlled query parameters are reflected into the HTML response, violating the standard mitigation for CWE-79. The upstream fix in Frappe 14.58.0 and 15.4.0 introduces escaping before parameter values reach the template.
Attack Vector
The attack vector is network-based and requires user interaction. An attacker crafts a URL that targets a Frappe printview endpoint, embeds a JavaScript payload within an affected parameter, and delivers the link via phishing email, chat, or an external website. When the authenticated victim visits the link, the browser executes the injected script against the Frappe origin. See the GitHub Security Advisory and VulnCheck Advisory for XSS for additional technical context.
No verified public proof-of-concept code is referenced in the available advisories, so no exploitation code is reproduced here.
Detection Methods for CVE-2024-58391
Indicators of Compromise
- Web server access logs containing requests to printview endpoints with query parameters that include angle brackets, <script> tags, javascript: URIs, or percent-encoded equivalents (%3Cscript%3E).
- Referer headers pointing to external attacker-controlled domains immediately before suspicious printview requests.
- Outbound requests from browsers to unfamiliar hosts shortly after a user loaded a printview URL, indicating potential session or token exfiltration.
Detection Strategies
- Deploy web application firewall (WAF) rules that flag reflected XSS payloads in query strings targeting /printview and related Frappe routes.
- Alert on Frappe application logs that show authenticated API calls originating from unexpected Referer values or occurring at anomalous times for the user account.
- Review browser Content Security Policy (CSP) violation reports for inline script execution attempts on Frappe-hosted pages.
Monitoring Recommendations
- Centralize Frappe nginx or reverse proxy logs and apply detections for URL-encoded script tags in parameters consumed by printview.
- Monitor for sudden privilege-sensitive actions (new users, role grants, API key creation) following a user session that accessed a printview URL.
- Track outbound DOM-based requests from Frappe pages using Real User Monitoring or client-side telemetry where available.
How to Mitigate CVE-2024-58391
Immediate Actions Required
- Upgrade Frappe to version 14.58.0 or 15.4.0 or later as published in the vendor security advisory.
- Inventory downstream applications, including ERPNext, and confirm they are rebuilt against a patched Frappe version.
- Rotate session cookies and administrative API keys if logs indicate interaction with suspicious printview URLs.
Patch Information
The Frappe maintainers released fixes in version 14.58.0 for the 14.x branch and version 15.4.0 for the 15.x branch. The patch adds output escaping to printview parameters so that attacker-supplied markup is rendered as literal text rather than executable HTML. Refer to the GitHub Security Advisory GHSA-v248-pv3c-jvgw for the authoritative patch references.
Workarounds
- Restrict access to the printview endpoint using reverse proxy rules until the upgrade is applied.
- Enforce a strict Content Security Policy that blocks inline scripts and disallows untrusted script sources, reducing the impact of reflected payloads.
- Mark session cookies as HttpOnly and Secure to limit cookie theft via injected JavaScript.
# Example nginx rule to block printview requests containing script tags
location /api/method/frappe.www.printview {
if ($args ~* "(<|%3C)\s*script") {
return 403;
}
proxy_pass http://frappe_backend;
}
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.
Sources: National Vulnerability Database, CISA KEV, Exploit-DB

