CVE-2021-32841: SharpZipLib Path Traversal Vulnerability
MODERATECVE-2021-32841 is a MODERATE (CVSS 4.0) path traversal vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting SharpZipLib libraries in the NuGet ecosystem. The issue involves path traversal in sharpziplib. Remediation is available by upgrading affected packages to version 1.3.3.
CVE-2021-32841 at a Glance
Security Impact
CVSS: 4.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N).
How to Fix CVE-2021-32841
To remediate this vulnerability, upgrade all affected SharpZipLib dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade SharpZipLib to 1.3.3
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for SharpZipLib
How to Check if You Are Affected
To determine whether your application is affected by CVE-2021-32841, inspect your project dependencies for SharpZipLib:
inspect dependencies for SharpZipLib
Analyze the terminal output to locate any version of SharpZipLib in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.3.3), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In SharpZipLib, 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-2021-32841 Affected SharpZipLib Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
SharpZipLib
|
NuGet |
≥ 1.3.0
< 1.3.3
|
1.3.3
|
References
Frequently Asked Questions
What is CVE-2021-32841?
Which SharpZipLib versions are affected?
What version fixes CVE-2021-32841?
Is SharpZipLib affected?
What is the CVSS score of CVE-2021-32841?
What CWE is associated with CVE-2021-32841?
How can I check NuGet dependencies for CVE-2021-32841?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2x7h-96h5-rq84",
"modified" : "2022-02-08T19:44:44Z",
"published" : "2022-02-01T16:22:57Z",
"aliases" : [ "CVE-2021-32841" ],
"summary" : "Path Traversal in SharpZipLib",
"details" : "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.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "NuGet",
"name" : "SharpZipLib"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.3.0"
}, {
"fixed" : "1.3.3"
} ]
} ]
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-32841"
}, {
"type" : "WEB",
"url" : "https://github.com/icsharpcode/SharpZipLib/commit/5c3b293de5d65b108e7f2cd0ea8f81c1b8273f78"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/icsharpcode/SharpZipLib"
}, {
"type" : "WEB",
"url" : "https://github.com/icsharpcode/SharpZipLib/releases/tag/v1.3.3"
}, {
"type" : "ADVISORY",
"url" : "https://securitylab.github.com/advisories/GHSL-2021-125-sharpziplib"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2022-02-01T16:21:00Z",
"nvd_published_at" : "2022-01-26T22:15:00Z"
}
}