CVE-2016-10745: Jinja2 Jinja2 Sandbox Escape Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-hj2j-77xm-mc5v
CVSS 8.6
CWE-134
Published
Advisory Summary

CVE-2016-10745 is a HIGH (CVSS 8.6) jinja2 sandbox escape vulnerability vulnerability (CWE-134: Use of Externally-Controlled Format String) affecting Jinja2 libraries in the PyPI ecosystem. The issue involves jinja2 sandbox escape vulnerability. Remediation is available by upgrading affected packages to version 2.8.1.

CVE-2016-10745 at a Glance

CVE Identifier CVE-2016-10745
GHSA Identifier GHSA-hj2j-77xm-mc5v
Severity HIGH
CVSS v3.1 Base Score 8.6
CWE Classification CWE-134: Use of Externally-Controlled Format String
Affected Product Jinja2
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.6

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Changed (S:C)
Confidentiality High (C:H)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2016-10745

To remediate this vulnerability, upgrade all affected Jinja2 dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Jinja2 fixed: 2.8.1
pip install Jinja2>=2.8.1
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show Jinja2

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2016-10745, inspect your installed packages using pip:

pip show Jinja2

Analyze the terminal output to locate any version of Jinja2 in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.8.1), your application is affected.

Note: The pip show Jinja2 command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-134: Use of Externally-Controlled Format String, where the product uses a function that accepts a format string as an argument, but the format string originates from an external source. In Jinja2, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

In Pallets Jinja before 2.8.1, str.format allows a sandbox escape.

CVE-2016-10745 Affected Jinja2 Versions

1 component(s)
Fixed Versions:
2.8.1
Product / Package Ecosystem Affected Versions Fixed Version
Jinja2
PyPI
< 2.8.1
2.8.1

References

Frequently Asked Questions

What is CVE-2016-10745?
CVE-2016-10745 is a security vulnerability in Jinja2 involving Jinja2 sandbox escape vulnerability under CWE-134: Use of Externally-Controlled Format String.
Which Jinja2 versions are affected?
Affected versions include releases prior to 2.8.1 across affected packages: Jinja2.
What version fixes CVE-2016-10745?
Upgrading to 2.8.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Jinja2 affected?
Yes, Jinja2 is affected in releases prior to 2.8.1. Upgrade your dependency to 2.8.1 or later.
What is the CVSS score of CVE-2016-10745?
CVE-2016-10745 has a CVSS v3.1 base score of 8.6 (HIGH) with vector string CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N.
What CWE is associated with CVE-2016-10745?
CVE-2016-10745 is classified under CWE-134: Use of Externally-Controlled Format String (The product uses a function that accepts a format string as an argument, but the format string originates from an external source.).
How can I check PyPI dependencies for CVE-2016-10745?
Run the dependency tree command: 'pip show Jinja2'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-hj2j-77xm-mc5v",
  "modified" : "2024-09-24T20:51:38Z",
  "published" : "2019-04-10T14:30:13Z",
  "aliases" : [ "CVE-2016-10745" ],
  "summary" : "Jinja2 sandbox escape vulnerability",
  "details" : "In Pallets Jinja before 2.8.1, str.format allows a sandbox escape.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:N/SC:H/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Jinja2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.8.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2016-10745"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pallets/jinja/commit/9b53045c34e61013dc8f09b7e52a555fa16bed16"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:1022"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:1237"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:1260"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:3964"
  }, {
    "type" : "WEB",
    "url" : "https://access.redhat.com/errata/RHSA-2019:4062"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-hj2j-77xm-mc5v"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pallets/jinja"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/jinja2/PYSEC-2019-220.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://palletsprojects.com/blog/jinja-281-released"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4011-1"
  }, {
    "type" : "WEB",
    "url" : "https://usn.ubuntu.com/4011-2"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2019-05/msg00030.html"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-security-announce/2019-06/msg00064.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-134" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:40:24Z",
    "nvd_published_at" : null
  }
}