Update zipslip_bad.py

This commit is contained in:
Ahmed Farid
2022-03-07 00:01:09 +01:00
committed by GitHub
parent 7f2d242702
commit 908db6a05f

View File

@@ -2,8 +2,8 @@ import zipfile
import shutil
def unzip(filename):
zf = zipfile.ZipFile()
with zf.open(filename) as zipf:
with zipfile.ZipFile(filename) as zipf:
#BAD : This could write any file on the filesystem.
for entry in zipf:
shutil.copyfileobj(entry, "/tmp/unpack/")
for entry in zipf:
shutil.copy(entry, "/tmp/unpack/")