Test files › Archives › nested-10-deep.zip
ZIP nested 10 levels deep
A ZIP containing a ZIP containing a ZIP, ten levels down, with a text file at the centre.
↓ Download nested-10-deep.zip| Filename | nested-10-deep.zip |
| Format | ZIP |
| Size | 1.2 KB (1,222 bytes) |
| MIME type | application/zip |
| SHA-256 | 0a16d5d585e29772e170d57f939b3211f2ad5649ce876afc2a0d0d9d42752ab4 |
What this file catchesRecursive scanners (antivirus, content indexers, import jobs) with no depth limit. A bounded extractor should stop at a configured depth and report it, not recurse forever.
Handle it in code
Each snippet below was run against this exact file with Python 3.14.4 and Node 24.15.0 when this page was built, and the output shown is what it printed.
Python
Recursive extraction needs a depth limit as well as a size limit, or one small file becomes an unbounded amount of work.
import io, zipfile
MAX_DEPTH = 3
def walk(data, depth=0):
with zipfile.ZipFile(io.BytesIO(data)) as z:
for info in z.infolist():
if info.filename.lower().endswith(".zip"):
if depth + 1 > MAX_DEPTH:
raise ValueError(f"refused: archives nested deeper than {MAX_DEPTH} ({info.filename})")
walk(z.read(info), depth + 1)
try:
with open("nested-10-deep.zip", "rb") as f:
walk(f.read())
print("ok")
except ValueError as e:
print(e)Run against this file, it prints: refused: archives nested deeper than 3 (level-4.zip)
Related guides and tools
Download & verify
curl -fsSL -o "nested-10-deep.zip" "https://files.hexaqa.com/archive/nested-10-deep.zip"
curl -fsSL "https://files.hexaqa.com/archive/nested-10-deep.zip" | sha256sum
# expect: 0a16d5d585e29772e170d57f939b3211f2ad5649ce876afc2a0d0d9d42752ab4