CWEweakness

CWE-1336 Improper Neutralization of Special Elements Used in a Template Engine

Official page ↗
Alternate terms
Server-Side Template Injection / SSTI, Client-Side Template Injection / CSTI
Abstraction
Base
Structure
Simple
Status
Incomplete
Languages
Interpreted, Java, JavaScript, PHP, Python
CWE version
5.0

Description

The product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine.

Extended description

In some cases, XSS-style attacks can work, which can obscure the root cause if the developer does not closely investigate the root cause of the error. Template engines can be used on the server or client, so both "sides" could be affected by injection. The mechanisms of attack or the affected technologies might be different, but the mistake is fundamentally the same.

Common consequences

• Integrity: Execute Unauthorized Code or Commands — If an attacker can influence input into a template before it is processed, then the attacker can invoke arbitrary expressions, i.e. perform injection attacks. For example, in some template languages, an attacker could inject the expression "{{7*7}}" and determine if the output returns "49" instead. The syntax varies depending on the language.

Potential mitigations

• [Architecture and Design] Choose a template engine that offers a sandbox or restricted mode, or at least limits the power of any available expressions, function calls, or commands. • [Implementation] Use the template engine's sandbox or restricted mode, if available.

Detection methods

• Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

Observed examples

• CVE-2024-34359: Chain: Python bindings for LLM library do not use a sandboxed environment when parsing a template and constructing a prompt, allowing jinja2 Server Side Template Injection and code execution - one variant of a "prompt injection" attack. • CVE-2017-16783: server-side template injection in content management server • CVE-2020-9437: authentication / identity management product has client-side template injection • CVE-2020-12790: Server-Side Template Injection using a Twig template • CVE-2021-21244: devops platform allows SSTI • CVE-2020-4027: bypass of Server-Side Template Injection protection mechanism with macros in Velocity templates • CVE-2020-26282: web browser proxy server allows Java EL expressions from Server-Side Template Injection • CVE-2020-1961: SSTI involving mail templates and JEXL expressions • CVE-2019-19999: product does not use a "safe" setting for a FreeMarker configuration, allowing SSTI • CVE-2018-20465: product allows read of sensitive database username/password variables using server-side template injection

Related

Observed example · CVE (10)

  • CVE-2024-34359 llama-cpp-python is the Python bindings for llama.cpp. vulnerability
  • CVE-2021-21244 OneDev is an all-in-one devops platform. vulnerability
  • CVE-2020-26282 BrowserUp Proxy allows you to manipulate HTTP requests and responses, capture HTTP content, and export performance data as a HAR file. vulnerability
  • CVE-2020-4027 Affected versions of Atlassian Confluence Server and Data Center allowed remote attackers with system administration permissions to bypass… vulnerability
  • CVE-2020-9437 SecureAuth.aspx in SecureAuth IdP 9.3.0 suffers from a client-side template injection that allows for script execution, in the same manner… vulnerability
  • CVE-2020-12790 In the SEOmatic plugin before 3.2.49 for Craft CMS, helpers/DynamicMeta.php does not properly sanitize the URL. vulnerability
  • CVE-2020-1961 Vulnerability to Server-Side Template Injection on Mail templates for Apache Syncope 2.0.X releases prior to 2.0.15, 2.1.X releases prior… vulnerability
  • CVE-2019-19999 Halo before 1.2.0-beta.1 allows Server Side Template Injection (SSTI) because TemplateClassResolver.SAFER_RESOLVER is not used in the… vulnerability
  • CVE-2018-20465 Craft CMS through 3.0.34 allows remote authenticated administrators to read sensitive information via server-side template injection, as… vulnerability
  • CVE-2017-16783 In CMS Made Simple 2.1.6, there is Server-Side Template Injection via the cntnt01detailtemplate parameter. vulnerability

Child of · CWE (1)

  • CWE-94 Improper Control of Generation of Code weakness

Referenced by CVE · weakness (288)

  • CVE-2026-119144 Frappe Framework before 15.111.0 and 16.x before 16.21.0 contains a server-side template injection vulnerability because user-controlled… vulnerability
  • CVE-2026-115223 The Smart Popup by Supsystic WordPress plugin before 2.0.2 does not prevent template-injection payloads from being stored in a popup text… vulnerability
  • CVE-2026-118803 Bricks Theme 2.4.3 and before contains an unauthenticated dynamic-data tag injection vulnerability that allows anonymous attackers to… vulnerability
  • CVE-2026-115189 A server-side template injection vulnerability exists in the Twig theme rendering sandbox of Mautic. vulnerability
  • CVE-2026-115938 Craft CMS allows any authenticated control panel user to submit an element-search condition whose element selector is evaluated as a… vulnerability
  • CVE-2026-55486 The Goobi viewer is a web application that allows digitised material to be displayed in a web browser. vulnerability
  • CVE-2026-96355 Improper Neutralization of Special Elements Used in a Template Engine vulnerability in Drupal Webform allows Code Injection. vulnerability
  • CVE-2026-96392 Improper Neutralization of Special Elements Used in a Template Engine vulnerability in Drupal AI CKEditor allows Code Injection. vulnerability
  • CVE-2026-78164 Improper Neutralization of Special Elements Used in a Template Engine and Exposure of Sensitive Information to an Unauthorized Actor… vulnerability
  • CVE-2026-105474 A server-side template injection exists in SolusVM 2 up to version 2.0.0-44576 that allows remote authenticated users to execute arbitrary… vulnerability
  • CVE-2026-55240 Tianji is an open source analytics, uptime monitoring, and server status platform. vulnerability
  • CVE-2026-92982 A flaw was found in Ansible Operator Plugins. vulnerability
  • CVE-2026-110593 BottleCRM through 1.14.5 contains a server-side template injection vulnerability in the send_email Celery task, which compiles the… vulnerability
  • CVE-2026-103849 Adobe Commerce is affected by an Improper Neutralization of Special Elements Used in a Template Engine vulnerability that could result in… vulnerability
  • CVE-2026-103528 Thelia 2.6.0 uses Smarty for email templates without properly restricting access to dangerous PHP functions. vulnerability
  • CVE-2026-103537 Thelia 2.6.1 contains an absolute path traversal vulnerability in its Smarty template handling that enables SSTI and remote code execution. vulnerability
  • CVE-2026-107248 Thelia 3.0.0's back-office Email/Messages feature contains a server‑side template injection (SSTI) flaw that allows any authenticated user… vulnerability
  • CVE-2026-109305 Craft CMS from 5.10.2 before 5.10.14 contains a Twig sandbox bypass that allows non-admin users to invoke PHP callables through the "has… vulnerability
  • CVE-2026-109652 Frappe ERPNext before 15.119.1 and 16.x before 16.32.0 contains a server-side template injection vulnerability because user-controlled… vulnerability
  • CVE-2026-108570 A security flaw has been discovered in Furion .NET Framework up to 4.9.9.95. vulnerability
  • CVE-2026-108264 Wizarr is an advanced user invitation and management system for Jellyfin, Plex, Emby, and other media servers. vulnerability
  • CVE-2026-105985 Craft CMS 5.10.13.2 contains an authenticated remote code execution vulnerability in the Control Panel action app/render-components. vulnerability
  • CVE-2026-106509 Backstage is an open framework for building developer portals. vulnerability
  • CVE-2026-67273 Dell Container Storage Modules, versions prior to 1.18.0, contain(s) an Improper Neutralization of Special Elements Used in a Template… vulnerability
  • CVE-2026-104851 fsspec is a specification and Python implementation framework for filesystem interfaces. vulnerability
  • CVE-2026-90970 GitLab has remediated a vulnerability in the GitLab AI Gateway component affecting all versions of the AI Gateway from 18.1.6 before… vulnerability
  • CVE-2026-103540 A security vulnerability has been detected in formtools.org Form Tools up to 3.1.1. vulnerability
  • CVE-2026-53964 Document Merge Service is a document template merge service providing an API to manage templates and merge them with given data. vulnerability
  • CVE-2026-102142 A system notification template on the Kiteworks appliance was rendered by a template engine that evaluated expressions contained in the… vulnerability
  • CVE-2026-102771 A security vulnerability has been detected in Naichen ThinkCMF up to 8.0.7. vulnerability
Show all 288 ›

Referenced by CWE · peer of (1)

  • CWE-917 Improper Neutralization of Special Elements used in an Expression Language Statement weakness

Referenced by OWASP · mapped cwe (1)