CVE-2017-5992: Openpyxl Improper Restriction Of XML External Vulnerability

MODERATE
Advisory Identifier: GHSA-chqf-hx79-gxc6
CVSS 8.2
CWE-611
Published
Advisory Summary

CVE-2017-5992 is a MODERATE (CVSS 8.2) improper restriction of xml external vulnerability (CWE-611: Improper Restriction of XML External Entity Reference) affecting Openpyxl libraries in the PyPI ecosystem. The issue involves improper restriction of xml external entity reference in openpyxl. Remediation is available by upgrading affected packages to version 2.4.2.

CVE-2017-5992 at a Glance

CVE Identifier CVE-2017-5992
GHSA Identifier GHSA-chqf-hx79-gxc6
Severity MODERATE
CVSS v3.1 Base Score 8.2
CWE Classification CWE-611: Improper Restriction of XML External Entity Reference
Affected Product Openpyxl
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.2

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

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

How to Fix CVE-2017-5992

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

openpyxl fixed: 2.4.2
pip install openpyxl>=2.4.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 openpyxl

How to Check if You Are Affected

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

pip show openpyxl

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-611: Improper Restriction of XML External Entity Reference, where the product processes an xml document that can contain xml entities with uris that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output. In Openpyxl, 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

Openpyxl 2.4.1 resolves external entities by default, which allows remote attackers to conduct XXE attacks via a crafted .xlsx document.

CVE-2017-5992 Affected Openpyxl Versions

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

References

Frequently Asked Questions

What is CVE-2017-5992?
CVE-2017-5992 is a security vulnerability in Openpyxl involving Improper Restriction of XML External Entity Reference in Openpyxl under CWE-611: Improper Restriction of XML External Entity Reference.
Which Openpyxl versions are affected?
Affected versions include releases prior to 2.4.2 across affected packages: openpyxl.
What version fixes CVE-2017-5992?
Upgrading to 2.4.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is openpyxl affected?
Yes, openpyxl is affected in releases prior to 2.4.2. Upgrade your dependency to 2.4.2 or later.
What is the CVSS score of CVE-2017-5992?
CVE-2017-5992 has a CVSS v3.1 base score of 8.2 (MODERATE) with vector string CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:H.
What CWE is associated with CVE-2017-5992?
CVE-2017-5992 is classified under CWE-611: Improper Restriction of XML External Entity Reference (The product processes an XML document that can contain XML entities with URIs that resolve to documents outside of the intended sphere of control, causing the product to embed incorrect documents into its output.).
How can I check PyPI dependencies for CVE-2017-5992?
Run the dependency tree command: 'pip show openpyxl'. 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-chqf-hx79-gxc6",
  "modified" : "2024-10-07T21:29:00Z",
  "published" : "2022-05-17T02:58:54Z",
  "aliases" : [ "CVE-2017-5992" ],
  "summary" : "Improper Restriction of XML External Entity Reference in Openpyxl",
  "details" : "Openpyxl 2.4.1 resolves external entities by default, which allows remote attackers to conduct XXE attacks via a crafted .xlsx document.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:C/C:H/I:N/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:N/VA:N/SC:H/SI:N/SA:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "openpyxl"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.4.2"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.4.1"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2017-5992"
  }, {
    "type" : "WEB",
    "url" : "https://bitbucket.org/openpyxl/openpyxl/commits/3b4905f428e1"
  }, {
    "type" : "WEB",
    "url" : "https://bitbucket.org/openpyxl/openpyxl/issues/749"
  }, {
    "type" : "WEB",
    "url" : "https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=854442"
  }, {
    "type" : "PACKAGE",
    "url" : "https://foss.heptapod.net/openpyxl/openpyxl"
  }, {
    "type" : "WEB",
    "url" : "https://foss.heptapod.net/openpyxl/openpyxl/-/commit/7fe678fd89fd"
  }, {
    "type" : "WEB",
    "url" : "https://foss.heptapod.net/openpyxl/openpyxl/-/issues/749"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-chqf-hx79-gxc6"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/openpyxl/PYSEC-2017-48.yaml"
  }, {
    "type" : "WEB",
    "url" : "http://www.openwall.com/lists/oss-security/2017/02/07/5"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-611" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-07-01T11:49:57Z",
    "nvd_published_at" : "2017-02-15T19:59:00Z"
  }
}