Skip to content

Commit

Permalink
Merge pull request #152 from BulkSecurityGeneratorProjectV2/fix/JLL/z…
Browse files Browse the repository at this point in the history
…ip-slip-vulnerability

[SECURITY] Fix Zip Slip Vulnerability
  • Loading branch information
forgivedengkai authored Aug 2, 2022
2 parents cc099bb + 1776cd6 commit 06f3c5e
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public static String unzip(File zipFile, String outputDirectory) throws Exceptio
while (entries.hasMoreElements()) {
ZipEntry entry = entries.nextElement();

File outputFile = new File(outputDirectory + uuid + File.separator + entry.getName());
File outputFile = new File(outputDirectory + uuid, entry.getName());

if (!outputFile.toPath().normalize().startsWith(outputDirectory + uuid)) {
throw new RuntimeException("Bad zip entry");
}
if (entry.isDirectory()) {
outputFile.mkdirs();
continue;
Expand Down

0 comments on commit 06f3c5e

Please sign in to comment.