Tag Archives: Improper Neutralization of Special Elements Used in a Template Engine

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

Read Time:1 Minute, 8 Second

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.

Modes of Introduction:

– Architecture and Design

 

 

Related Weaknesses

CWE-94

 

Consequences

Integrity: Execute Unauthorized Code or Commands

 

Potential Mitigations

Phase: Architecture and Design

Description: 

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.

Phase: Implementation

Description: 

Use the template engine’s sandbox or restricted mode, if available.

CVE References

  • 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-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