Headline
CVE-2022-4493: vuln-fix: Zip Slip Vulnerability · scifio/scifio@fcb0dbc
A vulnerability classified as critical was found in scifio. Affected by this vulnerability is the function downloadAndUnpackResource of the file src/test/java/io/scif/util/DefaultSampleFilesService.java of the component ZIP File Handler. The manipulation leads to path traversal. The attack can be launched remotely. The name of the patch is fcb0dbca0ec72b22fe0c9ddc8abc9cb188a0ff31. It is recommended to apply a patch to fix this issue. The associated identifier of this vulnerability is VDB-215803.
Permalink
Browse files
vuln-fix: Zip Slip Vulnerability
This fixes a Zip-Slip vulnerability.
This change does one of two things. This change either
- Inserts a guard to protect against Zip Slip. OR
- Replaces `dir.getCanonicalPath().startsWith(parent.getCanonicalPath())`, which is vulnerable to partial path traversal attacks, with the more secure `dir.getCanonicalFile().toPath().startsWith(parent.getCanonicalFile().toPath())`.
For number 2, consider `"/usr/outnot".startsWith(“/usr/out”)`. The check is bypassed although `/outnot` is not under the `/out` directory. It’s important to understand that the terminating slash may be removed when using various `String` representations of the `File` object. For example, on Linux, `println(new File(“/var”))` will print `/var`, but `println(new File("/var", “/”)` will print `/var/`; however, `println(new File("/var", “/”).getCanonicalPath())` will print `/var`.
Weakness: CWE-22: Improper Limitation of a Pathname to a Restricted Directory (‘Path Traversal’) Severity: High CVSSS: 7.4 Detection: CodeQL (https://codeql.github.com/codeql-query-help/java/java-zipslip/) & OpenRewrite (https://public.moderne.io/recipes/org.openrewrite.java.security.ZipSlip)
Reported-by: Jonathan Leitschuh [email protected] Signed-off-by: Jonathan Leitschuh [email protected]
Bug-tracker: JLLeitschuh/security-research#16
Co-authored-by: Moderne [email protected]
- Loading branch information
Related news
A vulnerability classified as critical was found in scifio. Affected by this vulnerability is the function downloadAndUnpackResource of the file src/test/java/io/scif/util/DefaultSampleFilesService.java of the component ZIP File Handler. The manipulation leads to path traversal. The attack can be launched remotely. The patch is at commit fcb0dbca0ec72b22fe0c9ddc8abc9cb188a0ff31. It is recommended to apply a patch to fix this issue. The associated identifier of this vulnerability is VDB-215803.