/

CVE-2026-55242

Severity:

HIGH RISK

(8.8)

Template Injection (CWE-1336) in ERPNext Permission Layer

CVE-2026-55242

Deferred

Vulnerability type

Category:

Server-Side Template Injection

CWE:

CWE-863, CWE-1336

Impact:

Unauthorized Data Access / Access Control Bypass

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

An authenticated template injection flaw in ERPNext allows standard operational users to inject server-side expressions via a configuration field, causing the backend template engine to execute unintended logic.

When exploited, this can expose data and records outside the attacker's normal permission scope, undermining ERPNext's access-control guarantees in multi-user environments.

Affected context

The vulnerability appears in ERPNext deployments where user-controlled configuration fields are rendered directly in server-side templates.

It is relevant in multi-tenant or multi-role ERP setups where standard operational users can edit configurable fields that later participate in server-side rendering.

The risk is highest where sensitive business data is segregated only by ERPNext's permission system and no additional data-layer access controls exist.

Exploit preconditions

  • Attack surface: Server-side template rendering paths that incorporate configuration fields editable by standard users.
  • Required access: Authenticated account with a normal operational role capable of setting or modifying the affected configuration field(s).
  • Trigger point: A server-side rendering operation that interpolates the stored configuration value into a template without proper sanitization or isolation.
  • Why exploitation is possible: The template engine evaluates attacker-controlled input as executable template syntax, allowing access to objects or helpers that bypass normal record-level permissions.

Why this happens

This issue stems from treating partially trusted configuration content as safe input to a server-side template engine.

Under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine, user-provided values are embedded directly into templates where reserved syntax is interpreted as executable expressions or code.

Combined with CWE-863: Incorrect Authorization, the evaluated expressions can reach data or functions not intended for the user, effectively bypassing the application's normal permission checks.

Conceptually, the bug is an authorization flaw enabled by unsafe mixing of user-controlled data and server-side template logic.

Potential impact

  • Unauthorized reading of sensitive business records that are normally protected by role-based permissions
  • Exposure of internal configuration details, metadata, or environment information accessible through template context objects
  • Lateral visibility into data belonging to other departments, tenants, or business units in a shared ERPNext instance
  • Facilitation of further privilege escalation or data exfiltration by leveraging leaked information

General mitigation guidance

Effective mitigation focuses on separating template logic from user-controlled content and hardening the authorization layer around rendered data.

Common defensive patterns include:

  • Treating all configuration fields as untrusted input and escaping or sanitizing content before passing it to the template engine
  • Restricting template syntax evaluation to static, developer-controlled templates and using plain variables for user data
  • Using dedicated, context-appropriate encoding (e.g., HTML-escaping, text-only fields) for any data rendered back to users
  • Enforcing strict role-based access control on who can modify configuration fields that influence global or cross-user behavior
  • Designing templates so that the rendering context exposes only the minimal set of objects and data required for presentation

How teams detect issues like this

Organizations can identify and monitor for this class of issue by:

  • Using static analysis or linters to flag patterns where user input is concatenated into template strings or evaluated as template code
  • Reviewing code paths where configuration or customizable fields are persisted and later interpolated into server-side views or emails
  • Implementing security-focused code review checklists that highlight template engine usage and verify proper escaping and authorization boundaries
  • Leveraging application security testing tools or fuzzers configured to send common template injection payload patterns to configurable fields and observing server responses

Sources

SourceLink
github.comgithub.com/frappe/erpnext/security/advisories/GHSA-pxf3-4gvc-v45j

Frequently asked

questions

Yes, but only by authenticated users. An attacker must log in and reach the specific configuration interface exposed through the ERPNext web application.

No. The issue can be triggered by users with a standard operational role, as long as they can edit the configuration field that feeds into server-side templates.

Avoid evaluating user-controlled data as template logic. Ensure that any user or configuration content is treated strictly as data, appropriately escaped, and rendered through static templates with minimal, well-defined context.

Adopt a development practice where any place that combines user input with server-side template engines undergoes special review, enforce principle-of-least-privilege for template contexts, and include template injection checks in automated testing and code review guidelines.

Find out what's already
exploitable in your codebase.