Advisory Database
  • Advisories
  • Dependency Scanning
  1. maven
  2. ›
  3. com.hubspot.jinjava/jinjava
  4. ›
  5. CVE-2025-59340

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

September 17, 2025 (updated September 22, 2025)

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).

References

  • github.com/HubSpot/jinjava
  • github.com/HubSpot/jinjava/commit/66df351e7e8ad71ca04dcacb4b65782af820b8b1
  • github.com/HubSpot/jinjava/releases/tag/jinjava-2.8.1
  • github.com/HubSpot/jinjava/security/advisories/GHSA-m49c-g9wr-hv6v
  • github.com/advisories/GHSA-m49c-g9wr-hv6v
  • nvd.nist.gov/vuln/detail/CVE-2025-59340

Code Behaviors & Features

Detect and mitigate CVE-2025-59340 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 2.8.1

Fixed versions

  • 2.8.1

Solution

Upgrade to version 2.8.1 or above.

Impact 9.8 CRITICAL

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

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

Source file

maven/com.hubspot.jinjava/jinjava/CVE-2025-59340.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Fri, 26 Sep 2025 12:19:59 +0000.