CVE-2025-66435 Details
Description
An SSTI (Server-Side Template Injection) vulnerability exists in the get_contract_template method of Frappe ERPNext through 15.89.0. The function renders attacker-controlled Jinja2 templates (contract_terms) using frappe.render_template() with a user-supplied context (doc). Although Frappe uses a custom SandboxedEnvironment, several dangerous globals such as frappe.db.sql are still available in the execution context via get_safe_globals(). An authenticated attacker with access to create or modify a Contract Template can inject arbitrary Jinja expressions into the contract_terms field, resulting in server-side code execution within a restricted but still unsafe context. This vulnerability can be used to leak database information.
A server-side template injection (SSTI) vulnerability has been identified in Frappe ERPNext versions through 15.89.0. The issue arises in the 'get_contract_template' method, where user-controlled Jinja2 templates are rendered using 'frappe.render_template()' with a context that can be manipulated by the user. Despite Frappe's implementation of a custom SandboxedEnvironment, several dangerous globals, including 'frappe.db.sql', remain accessible through 'get_safe_globals()', allowing for potential exploitation. An authenticated attacker with the ability to create or modify contract templates can inject arbitrary Jinja expressions into the 'contract_terms' field. This exploitation could lead to the execution of server-side code in a restricted but still hazardous context, with the possibility of leaking sensitive database information.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
CISA-ADP
Assessed Dec 16, 2025References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://iamanc.github.io/post/erpnext-ssti-bug-2 | [email protected] | ExploitThird Party Advisory |
| https://www.notion.so/SSTI-bug-2-239e6086eadc80878e8fcc7b6c26a584?source=copy_link | [email protected] | ExploitThird Party Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-94 | Improper Control of Generation of Code ('Code Injection') | [email protected] |
| CWE-1336 | Improper Neutralization of Special Elements Used in a Template Engine | CISA-ADP |
Affected Products
| Product | Versions |
|---|---|
| frappe erpnext | <= 15.89.0 |
CPE
Remediation
| |
Change History
6 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | [email protected] |
| Jun 17, 2026 | CVE Modified | CISA-ADP |
| Dec 23, 2025 | Initial Analysis | [email protected] |
| Dec 17, 2025 | CVE Modified | CISA-ADP |
| Dec 16, 2025 | CVE Modified | CISA-ADP |
| Dec 15, 2025 | New CVE Received | [email protected] |