CVE-2022-44900: Py7zr Path Traversal Vulnerability

CRITICAL
Advisory Identifier: GHSA-m8xw-9x5x-6vh3
CVSS 9.1
CWE-22
Published
Advisory Summary

CVE-2022-44900 is a CRITICAL (CVSS 9.1) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Py7zr libraries in the PyPI ecosystem. The issue involves py7zr directory traversal vulnerability. Remediation is available by upgrading affected packages to version 0.20.1.

CVE-2022-44900 at a Glance

CVE Identifier CVE-2022-44900
GHSA Identifier GHSA-m8xw-9x5x-6vh3
Severity CRITICAL
CVSS v3.1 Base Score 9.1
CWE Classification CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
Affected Product Py7zr
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 9.1

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

Attack Vector Network (AV:N)
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 None (A:N)

How to Fix CVE-2022-44900

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

py7zr fixed: 0.20.1
pip install py7zr>=0.20.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 py7zr

How to Check if You Are Affected

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

pip show py7zr

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Py7zr, 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

A directory traversal vulnerability in the SevenZipFile.extractall() function of the python library py7zr v0.20.0 and earlier allows attackers to write arbitrary files via extracting a crafted 7z file.

CVE-2022-44900 Affected Py7zr Versions

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

References

Frequently Asked Questions

What is CVE-2022-44900?
CVE-2022-44900 is a security vulnerability in Py7zr involving py7zr directory traversal vulnerability under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal').
Which Py7zr versions are affected?
Affected versions include releases prior to 0.20.1 across affected packages: py7zr.
What version fixes CVE-2022-44900?
Upgrading to 0.20.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is py7zr affected?
Yes, py7zr is affected in releases prior to 0.20.1. Upgrade your dependency to 0.20.1 or later.
What is the CVSS score of CVE-2022-44900?
CVE-2022-44900 has a CVSS v3.1 base score of 9.1 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N.
What CWE is associated with CVE-2022-44900?
CVE-2022-44900 is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') (The product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory.).
How can I check PyPI dependencies for CVE-2022-44900?
Run the dependency tree command: 'pip show py7zr'. 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-m8xw-9x5x-6vh3",
  "modified" : "2024-10-18T22:00:27Z",
  "published" : "2022-12-06T21:30:45Z",
  "aliases" : [ "CVE-2022-44900" ],
  "summary" : "py7zr directory traversal vulnerability",
  "details" : "A directory traversal vulnerability in the SevenZipFile.extractall() function of the python library py7zr v0.20.0 and earlier allows attackers to write arbitrary files via extracting a crafted 7z file.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:N"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "py7zr"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.20.1"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.20.0"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-44900"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/miurahr/py7zr/commit/1bb43f17515c7f69673a1c88ab9cc72a7bbef406"
  }, {
    "type" : "WEB",
    "url" : "https://advisory-inbox.githubapp.com/advisory_reviews/GHSA-m8xw-9x5x-6vh3"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/miurahr/py7zr"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/py7zr/PYSEC-2022-42998.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://lessonsec.com/cve/cve-2022-44900"
  }, {
    "type" : "WEB",
    "url" : "http://packetstormsecurity.com/files/170127/py7zr-0.20.0-Directory-Traversal.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-12-06T22:34:58Z",
    "nvd_published_at" : "2022-12-06T20:15:00Z"
  }
}