{"id":"CVE-2025-59340","aliases":["CVE-2025-59340","GHSA-m49c-g9wr-hv6v"],"related":[],"kind":"vulnerability","state":"published","title":"jinjava Sandbox Bypass via JavaType-Based Deserialization","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### Summary\n\njinjava’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.\n\nBy 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.\n\nAs 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).\n\n### Details\n\njinjava templates expose a built-in variable `____int3rpr3t3r____`, which provides direct access to the jinjavaInterpreter instance.\nThis 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)).\nHowever, 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).\n\nFrom `____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`.\n\nAlthough 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). \n\nAs a result, an attacker can leverage `JavaType` construction (`constructFromCanonical`) to instantiate semi-arbitrary classes without directly calling restricted methods.\n\nThis allows sandbox escape and the creation of powerful primitives. \n\n### Impact\nEscape the Jinjava sandbox and instantiate a wide range of classes using JavaType.\nThis capability can be used to read arbitrary files and to perform full read SSRF by creating network-related objects.\nIn certain environments, depending on the available classes, this primitive can even lead to complete remote code execution.","format":"markdown","source":"ghsa"},{"lang":"es","text":"jinjava es un motor de plantillas basado en Java, basado en la sintaxis de plantillas de Django, adaptado para renderizar plantillas Jinja. Anterior a 2.8.1, al usar mapper.getTypeFactory().constructFromCanonical(), es posible instruir al ObjectMapper subyacente para deserializar la entrada controlada por el atacante en clases arbitrarias. Esto permite la creación de instancias de clases semi-arbitrarias sin invocar directamente métodos restringidos o literales de clase. Como resultado, un atacante puede escapar de la sandbox e instanciar clases como java.net.URL, abriendo la capacidad de acceder a archivos locales y URLs (por ejemplo, file:///etc/p4sswd). Con un encadenamiento adicional, esta primitiva puede potencialmente conducir a la ejecución remota de código (RCE). Esta vulnerabilidad está corregida en 2.8.1.","source":"nvd"}],"published":"2025-09-17T19:56:21.000Z","modified":"2026-07-31T22:30:23.044Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","score":10,"rating":"CRITICAL"}],"cwes":["CWE-1336"],"affected":[{"ranges":[{"version":"< 2.8.1","status":"affected"}],"vendor":"HubSpot","product":"jinjava","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"2.8.0","status":"affected","fixed":"2.8.1"}],"ecosystem":"Maven","package":"com.hubspot.jinjava:jinjava","purl":"pkg:maven/com.hubspot.jinjava/jinjava","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"2.7.0","status":"affected","fixed":"2.7.5"}],"ecosystem":"Maven","package":"com.hubspot.jinjava:jinjava","purl":"pkg:maven/com.hubspot.jinjava/jinjava","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"2.8.1"}],"vendor":"hubspot","product":"jinjava","cpe":"cpe:2.3:a:hubspot:jinjava:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/HubSpot/jinjava/security/advisories/GHSA-m49c-g9wr-hv6v","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/HubSpot/jinjava/commit/66df351e7e8ad71ca04dcacb4b65782af820b8b1","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/HubSpot/jinjava/releases/tag/jinjava-2.8.1","tags":["release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59340","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/github/advisory-database/pull/8141","tags":["web"],"sources":["ghsa"]},{"url":"https://github.com/HubSpot/jinjava","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/HubSpot/jinjava/releases/tag/jinjava-2.7.5","tags":["web"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"yes","technicalImpact":"total","date":"2025-09-18T15:45:18.654Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2025-59340","url":"https://www.cve.org/CVERecord?id=CVE-2025-59340","licence":"CVE Terms of Use","modified":"2025-09-18T15:45:23.121Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-m49c-g9wr-hv6v","url":"https://github.com/advisories/GHSA-m49c-g9wr-hv6v","licence":"CC-BY-4.0","modified":"2026-07-31T22:30:23.044Z"},{"source":"nvd","name":"NVD","id":"CVE-2025-59340","url":"https://nvd.nist.gov/vuln/detail/CVE-2025-59340","licence":"Public domain","modified":"2026-06-17T09:45:56.163Z"}],"updatedAt":"2026-11-25T22:59:04.798Z","epss":{"score":0.02148,"percentile":0.82631,"date":"2026-12-01T12:00:22.000Z"}}