diff --git a/ache/src/main/java/achecrawler/crawler/CrawlersManager.java b/ache/src/main/java/achecrawler/crawler/CrawlersManager.java index 591231974..4b886df72 100644 --- a/ache/src/main/java/achecrawler/crawler/CrawlersManager.java +++ b/ache/src/main/java/achecrawler/crawler/CrawlersManager.java @@ -199,6 +199,9 @@ private void unzipFile(Path file, Path outputDir) throws IOException { continue; } File entryDestination = new File(outputDir.toFile(), entry.getName()); + if (!entryDestination.toPath().normalize().startsWith(outputDir.toFile().toPath().normalize())) { + throw new IOException("Bad zip entry"); + } if (entry.isDirectory()) { entryDestination.mkdirs(); } else {