Safeguard
Vulnerability Analysis•

CVE-2025-59340: Critical Sandbox Escape in HubSpot jinjava

CVE-2025-59340 lets template input escape the jinjava sandbox before 2.8.1, with a path to code execution. Upgrade to 2.8.1 or 2.7.5 on the 2.7 line.

Safeguard Security Team
3 min read

CVE-2025-59340 is a critical (CVSS 9.8) sandbox escape in HubSpot's jinjava template engine before 2.8.1. Attacker controlled template input can instantiate unintended classes and may lead to code execution. Upgrade to 2.8.1, or 2.7.5 if you are on the 2.7 line.

What's affected

From the GitHub advisory GHSA-m49c-g9wr-hv6v, for the Maven package com.hubspot.jinjava:jinjava:

  • 2.8.0 and earlier on the 2.8 line: fixed in 2.8.1.
  • 2.7.0 up to but not including 2.7.5: fixed in 2.7.5.

The NVD record states prior to 2.8.1. If you are on an older line than 2.7, the advisory does not list a patch for it, so plan to move to a fixed release.

How to check if you're exposed

Look for jinjava in your build. It is often a transitive dependency, pulled in by another library that renders templates.

mvn dependency:tree -Dincludes=com.hubspot.jinjava
./gradlew dependencies | grep -i jinjava

If the version shown is below 2.8.1 on the 2.8 line, or between 2.7.0 and 2.7.4, you are in range. Also search for the jar in deployed artifacts, such as fat jars and container images, because a build file does not always match what shipped.

What to do now

  1. Find every service that includes jinjava, direct or transitive.
  2. Upgrade to 2.8.1, or 2.7.5 if you must stay on 2.7.
  3. Rebuild and redeploy, then confirm the version in the running artifact and not only in the build file.
  4. Ask whether any template content comes from users or from untrusted tenants. Those services come first.
  5. Treat template editing rights as a privileged capability until you are patched.

Why it matters

The record maps this to CWE-1336, improper neutralization of special elements in a template engine. jinjava tries to restrict what templates can reach, for example by blocking dangerous methods and class lookups. The advisory describes a way around those limits that uses the engine's own JSON mapper to create instances of classes the sandbox meant to forbid, which opens access to local files and URLs and can potentially be chained further.

Sandboxes inside a language runtime are hard to get right, because every object reachable from the template is part of the attack surface. The practical lesson is that anyone who can write templates should be treated as able to run code on the server, unless you have separate isolation such as a locked down process or container. This CVE is not on the CISA KEV list, and I am not aware of exploitation from the sources I read.

Safeguard can help you find this one in your own software. The free in-browser dependency scan at gold.safeguard.sh/scan reads your manifest or lockfile and shows which known vulnerabilities your declared dependencies carry, including transitive ones. Reachability analysis then helps you separate the places where your code actually calls the affected component from the places where it only sits in the tree, which makes it easier to decide what to patch first.

Try it yourself

Click through it at your own pace, or open it full screen.

Quick check

Which versions fix CVE-2025-59340?

2.8.1 for the 2.8 line and 2.7.5 for the 2.7 line, per the GitHub advisory.

Does it matter if only our staff write templates?

It lowers the risk, but treat the question seriously. A compromised staff account or a shared editor would put you in the same position.

Sources

Last reviewed: 18 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.