Skip to main content

Frappe ERPNext CVE-2025-66435

MEDIUM
Code Injection (CWE-94)
2025-12-15 cve@mitre.org
4.3
CVSS 3.1 · NVD
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Authenticate as Contract Template editor
  2. Delivery
    Inject Jinja2 payload into contract_terms field
  3. Exploit
    Trigger get_contract_template render_template SSTI
  4. Execution
    Call frappe.db.sql via sandbox global
  5. Impact
    Exfiltrate 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.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
No patch listed yet 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

NVD PRIMARY 4.3 MEDIUM
AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:N
vuln.today AI 6.5 MEDIUM

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.

3.1 AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N

Primary rating from NVD.

CVSS VectorNVD

Attack Vector
Network
Attack Complexity
Low
Privileges Required
Low
User Interaction
None
Scope
Unchanged
Confidentiality
Low
Integrity
None
Availability
None

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

EPSS Score
0.3%
Top 75% exploitable
Prevalence
Medium
popular open-source ERP with moderate business adoption, not ubiquitous
Exploit
POC
Public exploit code exists
Data Quality
2 sources
Confidence: Low

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.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC Yes
EPSS 0.3%
Patch available No
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
No
Human Impact· derived
Medium

Priority Score

42
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +22
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

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

cpe:2.3:a:frappe:erpnext:*:*:*:*:*:*:*:*

More in Ssti

View all
CVE-2024-23692 CRITICAL POC
9.8 May 31

Rejetto HTTP File Server, up to and including version 2.3m, is vulnerable to a template injection vulnerability. Rated c

CVE-2025-47916 CRITICAL POC
10.0 May 16

Invision Community 5.0.0 through 5.0.6 contains an unauthenticated remote code execution vulnerability in the template e

CVE-2024-6386 CRITICAL POC
9.9 Aug 21

Remote code execution in the WPML WordPress multilingual plugin (versions up to and including 4.6.12) allows Contributor

CVE-2026-75650 CRITICAL POC
10.0 Sep 07

Server-side template injection in Adobe Commerce, Adobe Commerce B2B, and Magento Open Source allows remote unauthentica

CVE-2026-39980 CRITICAL POC
9.1 Apr 09

Server-Side Template Injection in OpenCTI notifier templates allows privileged administrators with 'Manage customization

CVE-2026-97359 CRITICAL POC
10.0 Sep 24

Unauthenticated remote code execution in Rejetto HFS2 (HTTP File Server) through version 2.4.0 lets an attacker execute

CVE-2025-23211 CRITICAL POC
9.9 Jan 28

Tandoor Recipes is an application for managing recipes, planning meals, and building shopping lists. Rated critical seve

CVE-2024-32651 CRITICAL POC
10.0 Apr 26

changedetection.io is an open source web page change detection, website watcher, restock monitor and notification servic

CVE-2024-4040 CRITICAL POC
10.0 Apr 22

A server side template injection vulnerability in CrushFTP in all versions before 10.7.1 and 11.1.0 on all platforms all

CVE-2026-15734 CRITICAL POC
9.8 Aug 06

Remote code execution in WGDashboard 4.3.2 and earlier lets authenticated attackers inject Server-Side Template Injectio

CVE-2024-24724 CRITICAL POC
9.8 Apr 03

Gibbon through 26.0.00 allows /modules/School%20Admin/messengerSettings.php Server Side Template Injection leading to Re

CVE-2026-77136 CRITICAL POC
9.5 Aug 25

Server-side template injection in the TYPO3 'Powermail' extension lets an anonymous user submit Fluid template syntax th

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy