4.0medium
Path Traversal in SharpZipLib
- Severity
- 4.0medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.11% (higher than 66% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-2x7h-96h5-rq84
Description
SharpZipLib (or #ziplib) is a Zip, GZip, Tar and BZip2 library. Starting version 1.3.0 and prior to version 1.3.3, a check was added if the destination file is under destination directory. However, it is not enforced that `destDir` ends with slash. If the `destDir` is not slash terminated like `/home/user/dir` it is possible to create a file with a name thats begins with the destination 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 contains a patch for this vulnerability.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| icsharpcode sharpziplib | from 1.3.3 before 1.3.3, from 1.3.0 before 1.3.0* | CVE List |
| SharpZipLib (NuGet) | from 1.3.0 before 1.3.3 | GitHub Advisory Database |
| sharpziplib_project sharpziplib | from 1.3.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.3.0 and prior to version 1.3.3, a check was added if the destination file is under destination directory. However, it is not enforced that `destDir` ends with slash. If the `destDir` is not slash terminated like `/home/user/dir` it is possible to create a file with a name thats begins with the destination 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 contains a patch for this vulnerability.
NVD (es)
SharpZipLib (o #ziplib) es una biblioteca Zip, GZip, Tar y BZip2. A partir de la versión 1.3.0 y versiones anteriores a 1.3.3, fue añadida una comprobación de si el archivo de destino está en el directorio de destino. Sin embargo, no es obligatorio que "destDir" termine en barra. Si "destDir" no termina en barra como "/home/user/dir" es posible crear un fichero con un nombre que empiece por el directorio de destino, por ejemplo "/home/user/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 contiene un parche para 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://github.com/icsharpcode/SharpZipLib/commit/5c3b293de5d65b108e7f2cd0ea8f81c1b8273f78 | patch, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-32841 | 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-32841 changed 2025-04-22 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-2x7h-96h5-rq84 changed 2024-02-19 | CC-BY-4.0 |
| NVD | CVE-2021-32841 changed 2026-06-17 | Public domain |