Frappe ERPNext CVE-2025-66435
MEDIUMAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessAuthenticate as Contract Template editor
-
DeliveryInject Jinja2 payload into contract_terms field
-
ExploitTrigger get_contract_template render_template SSTI
-
ExecutionCall frappe.db.sql via sandbox global
-
ImpactExfiltrate leaked database records
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Requires an authenticated ERPNext account (through 15.89.0) that holds create/modify permission on the Contract Template doctype; the attacker places a Jinja2 expression into the contract_terms field, which get_contract_template later passes to frappe.render_template() with the doc context. Exploitation is limited by that privilege requirement (not available to anonymous or minimally-privileged users) and by Frappe's custom SandboxedEnvironment, which restricts available operations - though get_safe_globals() still exposes frappe.db.sql, enabling database reads. No special non-default configuration is needed beyond having Contract Template functionality in use and a user role permitted to edit templates. |
| Impact | This is a medium-severity, authenticated information-disclosure issue rather than a top-priority emergency. The NVD CVSS 3.1 vector (AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N = 4.3) shows network-reachable, low-complexity exploitation but requires an authenticated account (PR:L) and yields only limited confidentiality impact with no integrity or availability effect. A public PoC exists (two NVD-referenced exploit writeups), which raises practical exploitability, but KEV status is NO and no EPSS score was provided, so there is no evidence of active or widespread exploitation - exploitation is therefore proof-of-concept only, not confirmed in-the-wild. The input Tags ('RCE', 'Code Injection') overstate the practical outcome relative to the CVSS vector: the description itself scopes impact to code execution 'within a restricted but still unsafe context' used 'to leak database information', consistent with C:L/I:N/A:N rather than full remote code execution. One signal worth noting as potentially understated: because the sandbox still exposes frappe.db.sql, an attacker can read arbitrary database rows, which is arguably higher than C:L - verify the real blast radius against your data sensitivity. Net: a real but gated issue (privileged insider or compromised low-trust account needed), not an unauthenticated internet-facing RCE. |
| Exploit ScenarioDerived | An attacker who holds an ERPNext account with permission to create or edit a Contract Template logs in and inserts a malicious Jinja2 expression (e.g., one calling frappe.db.sql) into the contract_terms field. When get_contract_template renders the template via frappe.render_template() with the doc context, the expression executes server-side inside the sandbox and returns database contents to the attacker. Public PoC/writeups demonstrating this technique are referenced by NVD, lowering the bar to reproduce it. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 14, 2026
Authenticated server-side template injection in Frappe ERPNext through 15.89.0 allows any user with create or modify permission on the Contract Template doctype to place arbitrary Jinja2 expressions into the contract_terms field, which the get_contract_template method later passes to frappe.render_template(). Because Frappe's get_safe_globals() still exposes dangerous callables such as frappe.db.sql despite the custom SandboxedEnvironment, an attacker can read arbitrary database contents, though no integrity or availability impact has been demonstrated. Publicly available exploit code exists (no CISA KEV listing), and exploitation is gated by the Contract Template privilege requirement, so this is best treated as a medium-severity, authenticated information-disclosure issue rather than a top-priority emergency.
RemediationAI
No vendor-released patch or fixed version was identified in the supplied data at the time of analysis, so remediation must currently rely on hardening the exposed template path and re-checking the ERPNext release notes for a version beyond 15.89.0. The most direct compensating control is to restrict the Contract Template doctype so that only a small, trusted set of roles can create or modify records - via ERPNext Role Permission Manager and, where feasible, custom user permissions - which removes the prerequisite authenticated editor from the threat model but does not fix the underlying injectable render call and may interrupt legitimate contract workflows. Second, disable or avoid populating contract_terms with user-supplied content and audit existing Contract Template records for suspicious Jinja expressions (look for {{ }}, {% %}, frappe.db.sql, __class__, or __globals__) before re-saving them. Third, apply Frappe's available sandbox hardening by ensuring the installed framework version does not expose frappe.db.sql through get_safe_globals() - where a newer framework build tightens that allowlist, upgrading the framework is the cleanest stopgap, with the trade-off that some existing contract templates relying on those globals may stop rendering. Finally, treat database credentials reachable from the ERPNext application user as compromised-adjacent: rotate secrets and monitor ERPNext and database logs for anomalous read queries originating from template rendering, since the demonstrated exploitation path is information disclosure rather than code execution.
Affects your stack
Find out whether the stacks and servers you run are on an affected version.
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
Frappe ERPNext is a Python/JavaScript web application built on the Frappe framework, which uses Jinja2 to render templates for documents, print formats, and contract terms. In CVE-2025-66435 (CWE-94, Improper Control of Generation of Code), the get_contract_template function calls frappe.render_template() on the attacker-controllable contract_terms field while supplying a user-influenced context (doc). Frappe wraps Jinja2 in a custom SandboxedEnvironment intended to block unsafe attributes and calls, but the sandbox's global allowlist assembled by get_safe_globals() still includes powerful framework objects such as frappe.db.sql, giving template expressions a path to direct database queries. The result is server-side template injection in a restricted-but-not-safe context: the attacker executes Jinja expressions as the ERPNext application user, which is sufficient for database exfiltration even though full arbitrary command execution has not been proven. The CPE cpe:2.3:a:frappe:erpnext:*:*:*:*:*:*:*:* indicates all ERPNext releases up to and including 15.89.0 are affected; independent assessment rates confidentiality impact as High with no integrity or availability impact, consistent with a read-oriented information-disclosure outcome.
Know when Ssti gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N
AV:N/AC:L/PR:L because a logged-in Contract Template editor exploits it reliably over the network; C:H (above NVD's C:L) since exposed frappe.db.sql can read arbitrary database data; I/A:N as the sandbox limits writes/disruption.
Primary rating from NVD.
CVSS VectorNVD
DescriptionNVD
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.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Affected Products (CPE)NVD
Rejetto HTTP File Server, up to and including version 2.3m, is vulnerable to a template injection vulnerability. Rated c
Invision Community 5.0.0 through 5.0.6 contains an unauthenticated remote code execution vulnerability in the template e
Remote code execution in the WPML WordPress multilingual plugin (versions up to and including 4.6.12) allows Contributor
Server-side template injection in Adobe Commerce, Adobe Commerce B2B, and Magento Open Source allows remote unauthentica
Server-Side Template Injection in OpenCTI notifier templates allows privileged administrators with 'Manage customization
Unauthenticated remote code execution in Rejetto HFS2 (HTTP File Server) through version 2.4.0 lets an attacker execute
Tandoor Recipes is an application for managing recipes, planning meals, and building shopping lists. Rated critical seve
changedetection.io is an open source web page change detection, website watcher, restock monitor and notification servic
A server side template injection vulnerability in CrushFTP in all versions before 10.7.1 and 11.1.0 on all platforms all
Remote code execution in WGDashboard 4.3.2 and earlier lets authenticated attackers inject Server-Side Template Injectio
Gibbon through 26.0.00 allows /modules/School%20Admin/messengerSettings.php Server Side Template Injection leading to Re
Server-side template injection in the TYPO3 'Powermail' extension lets an anonymous user submit Fluid template syntax th
NVD
CVE.org
EPSS
GitHub PoC
Exploit-DB