4.0medium
Path Traversal in SharpZipLib
- Severity
- 4.0medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.92% (higher than 61% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-mm6g-mmq6-53ff
Description
SharpZipLib (or #ziplib) is a Zip, GZip, Tar and BZip2 library. Starting version 1.0.0 and prior to version 1.3.3, a check was added if the destination file is under a destination directory. However, it is not enforced that `_baseDirectory` ends with slash. If the _baseDirectory is not slash terminated like `/home/user/dir` it is possible to create a file with a name thats begins as the destination directory one level up from the directory, i.e. `/home/user/dir.sh`. Because of the file name and destination directory constraints, the arbitrary file creation impact is limited and depends on the use case. Version 1.3.3 fixed this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| icsharpcode sharpziplib | from 1.3.3 before 1.3.3, from 1.0.0 before 1.0.0* | CVE List |
| SharpZipLib (NuGet) | from 1.0.0 before 1.3.3 | GitHub Advisory Database |
| sharpziplib_project sharpziplib | from 1.0.0 before 1.3.3 | NVD |
All scores
| GitHub_M | 4.0medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| GitHub | 4.0medium CVSS:3.1 | CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| NVD | 5.3medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N |
| NVD | 5.0medium CVSS:2.0 | AV:N/AC:L/Au:N/C:N/I:P/A:N |
Classification
SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.
What each source says
CVE List
SharpZipLib (or #ziplib) is a Zip, GZip, Tar and BZip2 library. Starting version 1.0.0 and prior to version 1.3.3, a check was added if the destination file is under a destination directory. However, it is not enforced that `_baseDirectory` ends with slash. If the _baseDirectory is not slash terminated like `/home/user/dir` it is possible to create a file with a name thats begins as the destination directory one level up from the directory, i.e. `/home/user/dir.sh`. Because of the file name and destination directory constraints, the arbitrary file creation impact is limited and depends on the use case. Version 1.3.3 fixed this vulnerability.
NVD (es)
SharpZipLib (o #ziplib) es una biblioteca Zip, GZip, Tar y BZip2. A partir de la versión 1.0.0 y versiones anteriores a 1.3.3, fue añadida una comprobación de si el archivo de destino está bajo un directorio de destino. Sin embargo, no es exigido que "_baseDirectory" termine en barra. Si el directorio base no termina en barra como "/home/usuario/dir" es posible crear un archivo con un nombre que comienza como el directorio de destino un nivel más arriba del directorio, por ejemplo "/home/usuario/dir.sh". Debido a las restricciones del nombre del archivo y del directorio de destino, el impacto de la creación arbitraria de archivos es limitado y depende del caso de uso. La versión 1.3.3 ha corregido esta vulnerabilidad
References
| https://securitylab.github.com/advisories/GHSL-2021-125-sharpziplib/ | exploit, third-party-advisory | |
| https://github.com/icsharpcode/SharpZipLib/releases/tag/v1.3.3 | release-notes, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-32842 | advisory | |
| https://github.com/icsharpcode/SharpZipLib | package | |
| https://securitylab.github.com/advisories/GHSL-2021-125-sharpziplib | advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-32842 changed 2025-04-22 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-mm6g-mmq6-53ff changed 2024-02-19 | CC-BY-4.0 |
| NVD | CVE-2021-32842 changed 2026-06-17 | Public domain |