

0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Still calibrating
click for more info
Not enough gems
Cost: 6 gems
1: Injection
incomplete
2: Fixing SQL Injection
incomplete
3: Injection Beyond SQL
incomplete
4: Safe Validation and Sanitization
incomplete
5: When to Sanitize
incomplete
6: Unsafe Archive Extraction
incomplete
7: Safe Archive Extraction
incomplete
8: LLM Prompt Injection
incomplete
9: Limiting Tool Calls
incomplete
10: Narrow Tool Interfaces
incomplete
11: File Upload Security
incomplete
Back
ctrl+,
Next
ctrl+.
This lesson's interactive features are locked, please to keep using them
A ZIP archive is not a single document. It is a container whose entries each have a name such as july/invoice.pdf. Extracting an untrusted archive turns those names into paths on your server.
Imagine an invoice service that joins every entry name to a trusted extraction directory:
for _, entry := range archive.File {
destination := filepath.Join(extractionDirectory, entry.Name)
// Write the entry to destination.
}
filepath.Join cleans the resulting path, but it does not prove that the destination remains inside extractionDirectory. An entry named ../../bearly-secure.log can escape the trusted directory after path normalization.
This vulnerability is commonly called Zip Slip. ZIP is only the delivery mechanism; the same path-traversal problem can occur whenever application code turns untrusted names into filesystem paths.
Checking the uploaded archive's filename or MIME type does not help. The dangerous paths are inside the archive, and every entry has its own attacker-controlled name.