CVE-2014-0012: Jinja2 Insecure Temporary File Vulnerability

MODERATE
Advisory Identifier: GHSA-fqh9-2qgg-h84h
CVSS 6.2
CWE-377
Published
Advisory Summary

CVE-2014-0012 is a MODERATE (CVSS 6.2) insecure temporary file vulnerability (CWE-377: Insecure Temporary File) affecting Jinja2 libraries in the PyPI ecosystem. The issue involves insecure temporary file in jinja2. Remediation is available by upgrading affected packages to version 2.7.2.

CVE-2014-0012 at a Glance

CVE Identifier CVE-2014-0012
GHSA Identifier GHSA-fqh9-2qgg-h84h
Severity MODERATE
CVSS v3.1 Base Score 6.2
CWE Classification CWE-377: Insecure Temporary File
Affected Product Jinja2
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 6.2

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:N/I:H/A:N).

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 None (C:N)
Integrity High (I:H)
Availability None (A:N)

How to Fix CVE-2014-0012

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-0012, 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-377: Insecure Temporary File, where creating and using insecure temporary files can leave application and system data vulnerable to attack. 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

FileSystemBytecodeCache in Jinja2 prior to version 2.7.2 does not properly create temporary directories, which allows local users to gain privileges by pre-creating a temporary directory with a user's uid. NOTE: this vulnerability exists because of an incomplete fix for CVE-2014-1402.

CVE-2014-0012 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-0012?
CVE-2014-0012 is a security vulnerability in Jinja2 involving Insecure Temporary File in Jinja2 under CWE-377: Insecure Temporary File.
Which Jinja2 versions are affected?
Affected versions include releases prior to 2.7.2 across affected packages: Jinja2.
What version fixes CVE-2014-0012?
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-0012?
CVE-2014-0012 has a CVSS v3.1 base score of 6.2 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N.
What CWE is associated with CVE-2014-0012?
CVE-2014-0012 is classified under CWE-377: Insecure Temporary File (Creating and using insecure temporary files can leave application and system data vulnerable to attack.).
How can I check PyPI dependencies for CVE-2014-0012?
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-fqh9-2qgg-h84h",
  "modified" : "2024-09-23T19:26:46Z",
  "published" : "2022-05-17T04:01:00Z",
  "aliases" : [ "CVE-2014-0012" ],
  "summary" : "Insecure Temporary File in Jinja2",
  "details" : "FileSystemBytecodeCache in Jinja2 prior to version 2.7.2 does not properly create temporary directories, which allows local users to gain privileges by pre-creating a temporary directory with a user's uid. NOTE: this vulnerability exists because of an incomplete fix for CVE-2014-1402.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:N/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-0012"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mitsuhiko/jinja2/pull/292"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mitsuhiko/jinja2/pull/296"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pallets/jinja2/pull/292"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pallets/jinja2/pull/296"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mitsuhiko/jinja2/commit/acb672b6a179567632e032f547582f30fa2f4aa7"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pallets/jinja/commit/acb672b6a179567632e032f547582f30fa2f4aa7"
  }, {
    "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" : "PACKAGE",
    "url" : "https://github.com/pallets/jinja2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/jinja2/PYSEC-2014-82.yaml"
  }, {
    "type" : "WEB",
    "url" : "http://seclists.org/oss-sec/2014/q1/73"
  }, {
    "type" : "WEB",
    "url" : "http://www.gentoo.org/security/en/glsa/glsa-201408-13.xml"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-377" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2023-02-14T00:58:39Z",
    "nvd_published_at" : "2014-05-19T14:55:00Z"
  }
}