# CVE-2025-59340: jinjava Sandbox Bypass via JavaType-Based Deserialization

> Attackers can bypass the sandbox in the jinjava template engine to instantiate arbitrary classes, potentially leading to remote code execution or local file access.

- **Severity:** Critical 9.8 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Sep 2025
- **Updated:** 18 Sep 2025
- **Also known as:** CLEANSTART-2026-ZM98216, GHSA-m49c-g9wr-hv6v, MINI-9v5w-fr43-g2jm

## What is CVE-2025-59340?

CVE-2025-59340 is a critical unsafe deserialization vulnerability in HubSpot jinjava, published on 17 Sep 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

jinjava is a Java-based template engine based on django template syntax, adapted to render jinja templates. Priori to 2.8.1, 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). This vulnerability is fixed in 2.8.1.

Weakness: CWE-1336 (Improper Neutralization of Special Elements Used in a Template Engine)

## Which versions are affected by CVE-2025-59340?

4 open source packages ship an affected version, including com.hubspot.jinjava:jinjava. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `com.hubspot.jinjava:jinjava` | Maven | From 2.7.0 | 2.7.5 |
| `com.hubspot.jinjava:jinjava` | Maven | From 2.7.0 | 2.7.5 |
| `com.hubspot.jinjava:jinjava` | Maven | From 2.8.0 | 2.8.1 |
| `com.hubspot.jinjava:jinjava` | Maven | From 2.8.0 | 2.8.1 |

Products: Hubspot Jinjava.

## How do I fix CVE-2025-59340?

Upgrade com.hubspot.jinjava:jinjava to a fixed version for your release line: 2.7.5 or 2.8.1.

## Is CVE-2025-59340 being exploited?

There is no known exploitation of CVE-2025-59340 in the wild and no public exploit code.

## Other vulnerabilities in HubSpot jinjava

- [CVE-2026-25526](https://insights.sbomify.com/CVE-2026-25526/): JinJava Bypass through ForTag leads to Arbitrary Java Execution (critical 9.8)
- [CVE-2020-12668](https://insights.sbomify.com/CVE-2020-12668/): Unauthorized access to Class instance in Jinjava (medium 6.5)
- [CVE-2018-18893](https://insights.sbomify.com/CVE-2018-18893/): Jinjava calls getClass (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-59340 and fix it if it is affected.

What it is: CVE-2025-59340 is a critical unsafe deserialization vulnerability in HubSpot jinjava, published on 17 Sep 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-59340 in the wild and no public exploit code.

Affected packages and fixed versions:
- com.hubspot.jinjava:jinjava (Maven): affected from 2.7.0; fixed in 2.7.5
- com.hubspot.jinjava:jinjava (Maven): affected from 2.7.0; fixed in 2.7.5
- com.hubspot.jinjava:jinjava (Maven): affected from 2.8.0; fixed in 2.8.1
- com.hubspot.jinjava:jinjava (Maven): affected from 2.8.0; fixed in 2.8.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-59340/ (Markdown: https://insights.sbomify.com/CVE-2025-59340/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-59340
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-59340
- OSV: https://osv.dev/vulnerability/CVE-2025-59340

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-59340/
Summaries are generated and may contain mistakes; the official description above is the record.
