CVE-2019-10906: Jinja2 Jinja2 Sandbox Escape Vulnerability
HIGHCVE-2019-10906 is a HIGH (CVSS 8.6) jinja2 sandbox escape vulnerability (CWE-693: Protection Mechanism Failure) affecting Jinja2 libraries in the PyPI ecosystem. The issue involves jinja2 sandbox escape via string formatting. Remediation is available by upgrading affected packages to version 2.10.1.
CVE-2019-10906 at a Glance
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).
How to Fix CVE-2019-10906
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.
pip install Jinja2>=2.10.1
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-2019-10906, 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.10.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-693: Protection Mechanism Failure, where the product does not use or incorrectly uses a protection mechanism that provides sufficient defense against directed attacks against the product. 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
CVE-2019-10906 Affected Jinja2 Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
Jinja2
|
PyPI |
< 2.10.1
|
2.10.1
|
References
Frequently Asked Questions
What is CVE-2019-10906?
Which Jinja2 versions are affected?
What version fixes CVE-2019-10906?
Is Jinja2 affected?
What is the CVSS score of CVE-2019-10906?
What CWE is associated with CVE-2019-10906?
How can I check PyPI dependencies for CVE-2019-10906?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-462w-v97r-4m45",
"modified" : "2024-09-24T20:49:55Z",
"published" : "2019-04-10T14:30:24Z",
"aliases" : [ "CVE-2019-10906" ],
"summary" : "Jinja2 sandbox escape via string formatting",
"details" : "In Pallets Jinja before 2.10.1, `str.format_map` allows a sandbox escape.\n\nThe sandbox is used to restrict what code can be evaluated when rendering untrusted, user-provided templates. Due to the way string formatting works in Python, the `str.format_map` method could be used to escape the sandbox.\n\nThis issue was previously addressed for the `str.format` method in Jinja 2.8.1, which discusses the issue in detail. However, the less-common `str.format_map` method was overlooked. This release applies the same sandboxing to both methods.\n\nIf you cannot upgrade Jinja, you can override the `is_safe_attribute` method on the sandbox and explicitly disallow the `format_map` method on string objects.",
"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.10.1"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2019-10906"
}, {
"type" : "WEB",
"url" : "https://usn.ubuntu.com/4011-2"
}, {
"type" : "WEB",
"url" : "https://usn.ubuntu.com/4011-1"
}, {
"type" : "WEB",
"url" : "https://palletsprojects.com/blog/jinja-2-10-1-released"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/TS7IVZAJBWOHNRDMFJDIZVFCMRP6YIUQ"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/QCDYIS254EJMBNWOG4S5QY6AOTOR4TZU"
}, {
"type" : "WEB",
"url" : "https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/DSW3QZMFVVR7YE3UT4YRQA272TYAL5AF"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/f0c4a03418bcfe70c539c5dbaf99c04c98da13bfa1d3266f08564316@%3Ccommits.airflow.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/b2380d147b508bbcb90d2cad443c159e63e12555966ab4f320ee22da@%3Ccommits.airflow.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/7f39f01392d320dfb48e4901db68daeece62fd60ef20955966739993@%3Ccommits.airflow.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/57673a78c4d5c870d3f21465c7e2946b9f8285c7c57e54c2ae552f02@%3Ccommits.airflow.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/46c055e173b52d599c648a98199972dbd6a89d2b4c4647b0500f2284@%3Cdevnull.infra.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/320441dccbd9a545320f5f07306d711d4bbd31ba43dc9eebcfc602df@%3Cdevnull.infra.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/2b52b9c8b9d6366a4f1b407a8bde6af28d9fc73fdb3b37695fd0d9ac@%3Cdevnull.infra.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://lists.apache.org/thread.html/09fc842ff444cd43d9d4c510756fec625ef8eb1175f14fd21de2605f@%3Cdevnull.infra.apache.org%3E"
}, {
"type" : "WEB",
"url" : "https://github.com/pypa/advisory-database/tree/main/vulns/jinja2/PYSEC-2019-217.yaml"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/pallets/jinja"
}, {
"type" : "ADVISORY",
"url" : "https://github.com/advisories/GHSA-462w-v97r-4m45"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/errata/RHSA-2019:1329"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/errata/RHSA-2019:1237"
}, {
"type" : "WEB",
"url" : "https://access.redhat.com/errata/RHSA-2019:1152"
}, {
"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-693" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-06-16T20:57:35Z",
"nvd_published_at" : "2019-04-07T00:29:00Z"
}
}