CVE-2025-66435: n/a
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.
AI Analysis
Technical Summary
CVE-2025-66435 is a Server-Side Template Injection vulnerability found in the get_contract_template method of Frappe ERPNext versions through 15.89.0. The vulnerability arises because the function renders user-supplied Jinja2 templates (specifically the contract_terms field) using frappe.render_template() with a user-controlled context (doc). Although Frappe employs a custom SandboxedEnvironment intended to restrict template execution, it still exposes dangerous global functions such as frappe.db.sql through get_safe_globals(), which attackers can leverage. An authenticated attacker with permissions to create or modify Contract Templates can inject arbitrary Jinja expressions, resulting in server-side code execution within the template rendering environment. This execution context, while restricted, is unsafe enough to allow attackers to perform unauthorized database queries and leak sensitive information. The vulnerability does not directly allow modification or deletion of data, nor does it affect system availability, but it compromises confidentiality by exposing database contents. Exploitation requires authentication with at least contract template modification privileges, no user interaction is needed, and the attack complexity is low due to the direct injection vector. No public exploits are known at this time, but the presence of dangerous globals in the template environment represents a significant security design flaw. The vulnerability is tracked under CWE-1336 (Improper Neutralization of Input During Template Processing).
Potential Impact
For European organizations using Frappe ERPNext, this vulnerability poses a risk of unauthorized disclosure of sensitive business data stored in the ERP system's database. Since ERPNext is often used for managing contracts, financials, and other critical business processes, leakage of contract details or internal data could lead to competitive disadvantage, regulatory non-compliance (e.g., GDPR violations), and reputational damage. The vulnerability requires authenticated access with specific privileges, so insider threats or compromised user accounts are the most likely exploitation vectors. While the vulnerability does not allow data modification or system disruption, the confidentiality breach alone can be significant, especially for organizations handling sensitive contracts or personal data. European companies in sectors such as finance, manufacturing, and professional services that rely on ERPNext for contract management are particularly at risk. The medium CVSS score reflects the limited scope of impact but should not lead to complacency given the potential for data leakage and compliance issues.
Mitigation Recommendations
To mitigate CVE-2025-66435, organizations should first upgrade Frappe ERPNext to a version where this vulnerability is patched once available. Until a patch is released, restrict access to contract template creation and modification functions to only the most trusted and necessary users to reduce the attack surface. Implement strict role-based access controls (RBAC) and monitor logs for unusual template changes or suspicious activity related to contract templates. Consider applying additional input validation or sanitization on the contract_terms field to prevent injection of malicious Jinja expressions. If possible, disable or limit the availability of dangerous globals such as frappe.db.sql in the template rendering environment by customizing the sandbox configuration. Conduct regular audits of user privileges and enforce strong authentication mechanisms to prevent account compromise. Finally, monitor for any indicators of compromise or attempts to exploit this vulnerability and prepare an incident response plan focused on data leakage scenarios.
Affected Countries
Germany, France, United Kingdom, Netherlands, Italy, Spain, Sweden, Belgium
CVE-2025-66435: n/a
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.
AI-Powered Analysis
Technical Analysis
CVE-2025-66435 is a Server-Side Template Injection vulnerability found in the get_contract_template method of Frappe ERPNext versions through 15.89.0. The vulnerability arises because the function renders user-supplied Jinja2 templates (specifically the contract_terms field) using frappe.render_template() with a user-controlled context (doc). Although Frappe employs a custom SandboxedEnvironment intended to restrict template execution, it still exposes dangerous global functions such as frappe.db.sql through get_safe_globals(), which attackers can leverage. An authenticated attacker with permissions to create or modify Contract Templates can inject arbitrary Jinja expressions, resulting in server-side code execution within the template rendering environment. This execution context, while restricted, is unsafe enough to allow attackers to perform unauthorized database queries and leak sensitive information. The vulnerability does not directly allow modification or deletion of data, nor does it affect system availability, but it compromises confidentiality by exposing database contents. Exploitation requires authentication with at least contract template modification privileges, no user interaction is needed, and the attack complexity is low due to the direct injection vector. No public exploits are known at this time, but the presence of dangerous globals in the template environment represents a significant security design flaw. The vulnerability is tracked under CWE-1336 (Improper Neutralization of Input During Template Processing).
Potential Impact
For European organizations using Frappe ERPNext, this vulnerability poses a risk of unauthorized disclosure of sensitive business data stored in the ERP system's database. Since ERPNext is often used for managing contracts, financials, and other critical business processes, leakage of contract details or internal data could lead to competitive disadvantage, regulatory non-compliance (e.g., GDPR violations), and reputational damage. The vulnerability requires authenticated access with specific privileges, so insider threats or compromised user accounts are the most likely exploitation vectors. While the vulnerability does not allow data modification or system disruption, the confidentiality breach alone can be significant, especially for organizations handling sensitive contracts or personal data. European companies in sectors such as finance, manufacturing, and professional services that rely on ERPNext for contract management are particularly at risk. The medium CVSS score reflects the limited scope of impact but should not lead to complacency given the potential for data leakage and compliance issues.
Mitigation Recommendations
To mitigate CVE-2025-66435, organizations should first upgrade Frappe ERPNext to a version where this vulnerability is patched once available. Until a patch is released, restrict access to contract template creation and modification functions to only the most trusted and necessary users to reduce the attack surface. Implement strict role-based access controls (RBAC) and monitor logs for unusual template changes or suspicious activity related to contract templates. Consider applying additional input validation or sanitization on the contract_terms field to prevent injection of malicious Jinja expressions. If possible, disable or limit the availability of dangerous globals such as frappe.db.sql in the template rendering environment by customizing the sandbox configuration. Conduct regular audits of user privileges and enforce strong authentication mechanisms to prevent account compromise. Finally, monitor for any indicators of compromise or attempts to exploit this vulnerability and prepare an incident response plan focused on data leakage scenarios.
Affected Countries
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- mitre
- Date Reserved
- 2025-11-30T00:00:00.000Z
- Cvss Version
- null
- State
- PUBLISHED
Threat ID: 69403ea1d9bcdf3f3deea90a
Added to database: 12/15/2025, 5:00:17 PM
Last enriched: 12/22/2025, 6:04:51 PM
Last updated: 2/7/2026, 4:13:16 AM
Views: 64
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Related Threats
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console in Console -> Billing for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.