CVE-2014-1402: Jinja2 Incorrect Privilege Assignment Vulnerability

HIGH
Advisory Identifier: GHSA-8r7q-cvjq-x353
CVSS 8.4
CWE-266
Published
Advisory Summary

CVE-2014-1402 is a HIGH (CVSS 8.4) incorrect privilege assignment vulnerability (CWE-266: Incorrect Privilege Assignment) affecting Jinja2 libraries in the PyPI ecosystem. The issue involves incorrect privilege assignment in jinja2. Remediation is available by upgrading affected packages to version 2.7.2.

CVE-2014-1402 at a Glance

CVE Identifier CVE-2014-1402
GHSA Identifier GHSA-8r7q-cvjq-x353
Severity HIGH
CVSS v3.1 Base Score 8.4
CWE Classification CWE-266: Incorrect Privilege Assignment
Affected Product Jinja2
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.4

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

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

How to Fix CVE-2014-1402

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.7.2
pip install Jinja2>=2.7.2
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-2014-1402, 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.7.2), 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-266: Incorrect Privilege Assignment, where a product incorrectly assigns a privilege to a particular actor, creating an unintended sphere of control for that actor. 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

The default configuration for `bccache.FileSystemBytecodeCache` in Jinja2 before 2.7.2 does not properly create temporary files, which allows local users to gain privileges via a crafted .cache file with a name starting with `__jinja2_` in `/tmp`.

CVE-2014-1402 Affected Jinja2 Versions

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

References

Frequently Asked Questions

What is CVE-2014-1402?
CVE-2014-1402 is a security vulnerability in Jinja2 involving Incorrect Privilege Assignment in Jinja2 under CWE-266: Incorrect Privilege Assignment.
Which Jinja2 versions are affected?
Affected versions include releases prior to 2.7.2 across affected packages: Jinja2.
What version fixes CVE-2014-1402?
Upgrading to 2.7.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Jinja2 affected?
Yes, Jinja2 is affected in releases prior to 2.7.2. Upgrade your dependency to 2.7.2 or later.
What is the CVSS score of CVE-2014-1402?
CVE-2014-1402 has a CVSS v3.1 base score of 8.4 (HIGH) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2014-1402?
CVE-2014-1402 is classified under CWE-266: Incorrect Privilege Assignment (A product incorrectly assigns a privilege to a particular actor, creating an unintended sphere of control for that actor.).
How can I check PyPI dependencies for CVE-2014-1402?
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-8r7q-cvjq-x353",
  "modified" : "2024-09-24T18:41:55Z",
  "published" : "2022-05-14T04:04:14Z",
  "aliases" : [ "CVE-2014-1402" ],
  "summary" : "Incorrect Privilege Assignment in Jinja2",
  "details" : "The default configuration for `bccache.FileSystemBytecodeCache` in Jinja2 before 2.7.2 does not properly create temporary files, which allows local users to gain privileges via a crafted .cache file with a name starting with `__jinja2_` in `/tmp`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "Jinja2"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.7.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2014-1402"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=734747"
  }, {
    "type" : "WEB",
    "url" : "https://bugzilla.redhat.com/show_bug.cgi?id=1051421"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-8r7q-cvjq-x353"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/jinja2/PYSEC-2014-8.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://oss.oracle.com/pipermail/el-errata/2014-June/004192.html"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20150523060528/http://www.mandriva.com/en/support/security/advisories/advisory/MDVSA-2014:096/?name=MDVSA-2014:096"
  }, {
    "type" : "WEB",
    "url" : "http://advisories.mageia.org/MGASA-2014-0028.html"
  }, {
    "type" : "WEB",
    "url" : "http://jinja.pocoo.org/docs/changelog"
  }, {
    "type" : "WEB",
    "url" : "http://openwall.com/lists/oss-security/2014/01/10/2"
  }, {
    "type" : "WEB",
    "url" : "http://openwall.com/lists/oss-security/2014/01/10/3"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2014-0747.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2014-0748.html"
  }, {
    "type" : "WEB",
    "url" : "http://www.gentoo.org/security/en/glsa/glsa-201408-13.xml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-266" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-07T22:50:31Z",
    "nvd_published_at" : "2014-05-19T14:55:00Z"
  }
}