Jelly Template Injection is a server-side injection flaw in applications that use Jelly templates for dynamic page rendering. An attacker controls template input or template data so the engine evaluates unintended expressions, which can expose data, alter logic, or enable further code execution.
What Jelly Template Injection Is in Practice
Jelly template injection is a server-side expression injection problem, not just a rendering bug. When attacker-controlled input reaches the Jelly engine as template data or template source, the application may evaluate expressions the developer never intended, which can change logic, expose server-side data, or become a stepping stone to broader compromise.
That makes the issue especially important in applications that treat templating as a safe presentation layer. The risk is not limited to visible page content, because the template engine itself becomes part of the attack surface whenever it processes untrusted values.
For a broader view of why this class matters, the OWASP Top 10 treats injection as a recurring pattern across modern web applications, and Jelly template injection fits the same defensive logic even though the implementation details differ.
How Jelly Injection Happens
The vulnerable condition is usually a trust boundary failure between user input and template evaluation. A developer may pass parameters, message text, metadata, or other dynamic fields into a template context and assume they will be rendered literally, but Jelly may interpret special syntax as executable expression content instead.
The exact trigger depends on how the application constructs templates and how much control an attacker has over the rendered content. In some cases the attacker only needs one tainted field. In others, the flaw appears when fragments of template markup are assembled dynamically from multiple sources, such as request parameters, CMS fields, or configuration values.
That is why server-side template injection is often treated as a design flaw as much as a code flaw. Once untrusted data can affect evaluation, the boundary between content and execution is no longer reliable.
Why It Can Become Dangerous
Even when the first effect is “only” altered page logic, template injection can expose sensitive data, reveal server-side variables, or bypass intended controls in the rendering path. In some applications, expression evaluation can also reach objects or helper methods that were never meant to be available to the requester.
The danger increases when the template engine has access to secrets, session state, internal service data, or privileged application objects. At that point the flaw is not just about broken output formatting, it can become a route to server-side information disclosure and, depending on the environment, further execution or privilege abuse.
Template injection also tends to be hard to reason about during review because the dangerous behavior may be indirect. The vulnerable line can look harmless if the developer is thinking in terms of text rendering rather than runtime evaluation.
Defensive Controls and Verification
Prevention starts with strict separation of untrusted data from template code. Templates should come from trusted application assets, while user-controlled content should be passed as data only and rendered with safe escaping or equivalent literal handling.
Security review should focus on where template strings are assembled, where expressions are enabled, and whether user input can reach helper functions, includes, or dynamic evaluation paths. If a Jelly-based component must support rich user content, it needs a clearly defined allowlist and test coverage that proves expression syntax cannot be reintroduced through edge cases.
Server-Side Template Injection (SSTI) Guide is the best companion for understanding the broader defensive pattern, while OWASP Top 10 A05 Guide places Jelly injection in the wider injection-defence model. For teams validating exposure in real systems, Web Application Attacks Guide gives the broader attack-class context.
Where this pattern appears in code review or incident response, OWASP Top 10 remains the canonical reference for framing the risk as an injection issue rather than a one-off framework quirk.
Risk and Threat Considerations
Jelly template injection is dangerous because it turns a presentation layer into an execution boundary. If an attacker can control template input, they may be able to disclose server-side data, alter application behaviour, or pivot into deeper exploitation depending on what the template engine can reach.
Failure mechanism: The application treats attacker-influenced text as template syntax, so Jelly evaluates expressions or references that should never have been executable.
Impact: The result can include data leakage, logic manipulation, account or session exposure, and in some deployments a path toward broader server-side compromise.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
OWASP ASVS, CIS Controls v8, NIST CSF 2.0 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP ASVS | V1 — Encoding and Sanitization | Jelly injection is prevented by keeping untrusted input out of executable template syntax. |
| V15 — Secure Coding and Architecture | The flaw is a design-level trust-boundary failure between input and template evaluation. | |
| Recommendation — Encode or sanitize user-controlled content so Jelly renders it literally, not as expressions. Separate template code from user data and forbid dynamic evaluation of attacker-influenced content. | ||
| CIS Controls v8 | CIS-16 — Application Software Security | This is an application-layer injection weakness that belongs in secure development and review practices. |
| Recommendation — Review templating code paths for injection and verify rendering logic with security testing. | ||
| NIST CSF 2.0 | PR.DS-01 — Data-at-rest is protected | Template injection can expose server-side data and secrets held by the application. |
| Recommendation — Protect sensitive application data so template compromise does not expose high-value content. | ||
| NIST SP 800-53 Rev 5 | SI-10 — Information Input Validation | The issue arises when untrusted input is accepted into a context that is later evaluated as template logic. |
| Recommendation — Validate and constrain input before it reaches any Jelly evaluation path. | ||
Practitioner Guidance
What to watch for: Review every path where application data is converted into a Jelly template or injected into a rendering context. The critical question is not whether the page “escapes output,” but whether the engine ever evaluates untrusted content as code-like template syntax.
Governance implication: Ownership should sit with the application team that controls rendering, because this is a design-and-implementation issue, not a generic web-server setting. Treat template engines as part of the security boundary, and require tests that prove untrusted fields remain literal across normal and edge-case inputs.
Practitioner takeaway: If the application must render dynamic content, design for literal data flow first, then prove by testing that no user-controlled value can ever become template logic.
Related resources from NHI Mgmt Group
- Why do server-side template injection bugs create broader risk than XSS?
- What breaks when client-side template injection is left uncontained?
- How should security teams prevent server-side template injection in CI/CD-driven applications?
- Why do unsafe Handlebars helpers and raw template output create a higher injection risk in modern application stacks?
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 25, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org