/** * @name Arbitrary file write during archive extraction ("Zip Slip") * @description Extracting files from a malicious archive without validating that the * destination file path is within the destination directory can cause files outside * the destination directory to be overwritten. * @kind path-problem * @id py/zipslip * @problem.severity error * @security-severity 7.5 * @precision high * @tags security * external/cwe/cwe-022 */ import python import experimental.semmle.python.security.ZipSlip import DataFlow::PathGraph from ZipSlipConfig config, DataFlow::PathNode source, DataFlow::PathNode sink where config.hasFlowPath(source, sink) select sink.getNode(), source, sink, "Extraction of zipfile from $@", source.getNode(), "a potentially untrusted source"