CVE-2025-59340: CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine in HubSpot jinjava
### Summary jinjava’s current sandbox restrictions prevent direct access to dangerous methods such as `getClass()`, and block instantiation of Class objects. However, these protections can be bypassed. By using mapper.getTypeFactory().constructFromCanonical(), it is possible to instruct the underlying ObjectMapper to deserialize attacker-controlled input into arbitrary classes. This enables the creation of semi-arbitrary class instances without directly invoking restricted methods or class literals. As a result, an attacker can escape the sandbox and instantiate classes such as java.net.URL, opening up the ability to access local files and URLs(e.g., file:///etc/passwd). With further chaining, this primitive can potentially lead to remote code execution (RCE). ### Details jinjava templates expose a built-in variable `____int3rpr3t3r____`, which provides direct access to the jinjavaInterpreter instance. This variable was previously abused and protections were added to prevent call method from `JinjavaInterpreter` instances (see [Add interpreter to blacklist](https://github.com/HubSpot/jinjava/commit/1b9aaa4b420c58b4a301cf4b7d26207f1c8d1165)). However, interacting with the properties of `JinjavaInterpreter` instances remains [unrestricted](https://github.com/HubSpot/jinjava/blob/jinjava-2.8.0/src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java#L80-L84). From `____int3rpr3t3r____`, it is possible to traverse to the `config` field, which exposes an ObjectMapper. By invoking `readValue(String content, JavaType valueType)` on this ObjectMapper, an attacker can instantiate arbitrary classes specified via `JavaType`. Although jinjava explicitly restricts dangerous classes such as `Class`, `ClassLoader`, and so on inside `JinjavaBeanELResolver`, the `JavaType` class itself is [not restricted](https://github.com/HubSpot/jinjava/blob/jinjava-2.8.0/src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java#L246-L262). As a result, an attacker can leverage `JavaType` construction (`constructFromCanonical`) to instantiate semi-arbitrary classes without directly calling restricted methods. This allows sandbox escape and the creation of powerful primitives. ### Impact Escape the Jinjava sandbox and instantiate a wide range of classes using JavaType. This capability can be used to read arbitrary files and to perform full read SSRF by creating network-related objects. In certain environments, depending on the available classes, this primitive can even lead to complete remote code execution.
AI Analysis
Technical Summary
The vulnerability in jinjava arises from insufficient sandbox restrictions on the JavaType class used by the underlying ObjectMapper. Although direct access to dangerous methods like getClass() and instantiation of Class objects are blocked, attackers can use the built-in variable ____int3rpr3t3r____ to access the jinjavaInterpreter instance, traverse to its config field exposing an ObjectMapper, and invoke readValue with a crafted JavaType. This allows instantiation of arbitrary classes without directly invoking restricted methods, enabling sandbox escape. The exploit can lead to reading local files, SSRF, and potentially remote code execution depending on the environment and available classes. The vulnerability affects versions prior to 2.8.1.
Potential Impact
Successful exploitation allows attackers to escape the jinjava sandbox and instantiate arbitrary classes, leading to the ability to read arbitrary files (e.g., local system files), perform server-side request forgery (SSRF) by creating network-related objects, and potentially achieve remote code execution. This represents a critical security risk with high confidentiality, integrity, and availability impacts.
Mitigation Recommendations
A fix is available in jinjava version 2.8.1 and later. Users should upgrade to version 2.8.1 or newer to remediate this vulnerability. No other mitigations are indicated in the advisory. Patch status is confirmed by the affectedVersions field indicating versions <2.8.1 are vulnerable.
CVE-2025-59340: CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine in HubSpot jinjava
Description
### Summary jinjava’s current sandbox restrictions prevent direct access to dangerous methods such as `getClass()`, and block instantiation of Class objects. However, these protections can be bypassed. By using mapper.getTypeFactory().constructFromCanonical(), it is possible to instruct the underlying ObjectMapper to deserialize attacker-controlled input into arbitrary classes. This enables the creation of semi-arbitrary class instances without directly invoking restricted methods or class literals. As a result, an attacker can escape the sandbox and instantiate classes such as java.net.URL, opening up the ability to access local files and URLs(e.g., file:///etc/passwd). With further chaining, this primitive can potentially lead to remote code execution (RCE). ### Details jinjava templates expose a built-in variable `____int3rpr3t3r____`, which provides direct access to the jinjavaInterpreter instance. This variable was previously abused and protections were added to prevent call method from `JinjavaInterpreter` instances (see [Add interpreter to blacklist](https://github.com/HubSpot/jinjava/commit/1b9aaa4b420c58b4a301cf4b7d26207f1c8d1165)). However, interacting with the properties of `JinjavaInterpreter` instances remains [unrestricted](https://github.com/HubSpot/jinjava/blob/jinjava-2.8.0/src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java#L80-L84). From `____int3rpr3t3r____`, it is possible to traverse to the `config` field, which exposes an ObjectMapper. By invoking `readValue(String content, JavaType valueType)` on this ObjectMapper, an attacker can instantiate arbitrary classes specified via `JavaType`. Although jinjava explicitly restricts dangerous classes such as `Class`, `ClassLoader`, and so on inside `JinjavaBeanELResolver`, the `JavaType` class itself is [not restricted](https://github.com/HubSpot/jinjava/blob/jinjava-2.8.0/src/main/java/com/hubspot/jinjava/el/ext/JinjavaBeanELResolver.java#L246-L262). As a result, an attacker can leverage `JavaType` construction (`constructFromCanonical`) to instantiate semi-arbitrary classes without directly calling restricted methods. This allows sandbox escape and the creation of powerful primitives. ### Impact Escape the Jinjava sandbox and instantiate a wide range of classes using JavaType. This capability can be used to read arbitrary files and to perform full read SSRF by creating network-related objects. In certain environments, depending on the available classes, this primitive can even lead to complete remote code execution.
CVSS v3.1
Score 9.8critical
Affected software
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability in jinjava arises from insufficient sandbox restrictions on the JavaType class used by the underlying ObjectMapper. Although direct access to dangerous methods like getClass() and instantiation of Class objects are blocked, attackers can use the built-in variable ____int3rpr3t3r____ to access the jinjavaInterpreter instance, traverse to its config field exposing an ObjectMapper, and invoke readValue with a crafted JavaType. This allows instantiation of arbitrary classes without directly invoking restricted methods, enabling sandbox escape. The exploit can lead to reading local files, SSRF, and potentially remote code execution depending on the environment and available classes. The vulnerability affects versions prior to 2.8.1.
Potential Impact
Successful exploitation allows attackers to escape the jinjava sandbox and instantiate arbitrary classes, leading to the ability to read arbitrary files (e.g., local system files), perform server-side request forgery (SSRF) by creating network-related objects, and potentially achieve remote code execution. This represents a critical security risk with high confidentiality, integrity, and availability impacts.
Mitigation Recommendations
A fix is available in jinjava version 2.8.1 and later. Users should upgrade to version 2.8.1 or newer to remediate this vulnerability. No other mitigations are indicated in the advisory. Patch status is confirmed by the affectedVersions field indicating versions <2.8.1 are vulnerable.
Technical Details
- Data Version
- 5.1
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2025-09-12T12:36:24.635Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 68cb15679d86941e1ccd2bf8
Added to database: 09/17/2025, 20:09:11 UTC
Last enriched: 08/01/2026, 21:28:34 UTC
Last updated: 08/25/2026, 22:52:07 UTC
Views: 774
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.