CVE-2025-66438: Code Injection
A Server-Side Template Injection (SSTI) vulnerability exists in the Frappe ERPNext through 15.89.0 Print Format rendering mechanism. Specifically, the API frappe.www.printview.gethtmlandstyle() triggers the rendering of the html field inside a Print Format document using frappe.rendertemplate(template, doc) via the getrenderedtemplate() call chain. Although ERPNext wraps Jinja2 in a SandboxedEnvironment, it exposes sensitive functions such as frappe.db.sql through getsafeglobals(). An authenticated attacker with permission to create or modify a Print Format can inject arbitrary Jinja expressions into the html field. Once the malicious Print Format is saved, the attacker can call gethtmlandstyle() with a target document (e.g., Supplier or Sales Invoice) to trigger the render process. This leads to information disclosure from the database, such as database version, schema details, or sensitive values, depending on the injected payload. Exploitation flow: Create a Print Format with SSTI payload in the html field; call the gethtmlandstyle() API; triggers frappe.rendertemplate(template, doc) inside getrenderedtemplate(); leaks database information via frappe.db.sql or other exposed globals.
Affected Software
Event History
Frequently Asked Questions
What is the severity of CVE-2025-66438?
CVE-2025-66438 is classified as a high severity vulnerability due to its potential for remote code execution.
How do I fix CVE-2025-66438?
To fix CVE-2025-66438, upgrade Frappe and ERPNext to versions beyond 15.89.0 where the vulnerability has been patched.
What systems are affected by CVE-2025-66438?
CVE-2025-66438 affects Frappe and ERPNext versions up to and including 15.89.0.
What is Server-Side Template Injection in the context of CVE-2025-66438?
In the context of CVE-2025-66438, Server-Side Template Injection allows an attacker to inject malicious templates that can be executed on the server.
Can CVE-2025-66438 be exploited remotely?
Yes, CVE-2025-66438 can be exploited remotely if an attacker has access to submit specially crafted print format documents.