How to Detect & Prevent Zip Slip Path Traversal Vulnerabilities
Audit compressed archives for malicious file entries attempting to overwrite system files.
Zip Slip is a critical security vulnerability where an archive contains filenames with directory traversal characters (e.g. '../../etc/passwd'). When unpacked by vulnerable extraction libraries, the archive writes files outside the target directory, enabling arbitrary remote code execution.
Root Cause Analysis
Extraction libraries that blindly concatenate the archive entry path with the destination directory without validating whether the resolved canonical path remains within the target folder.
Step-by-Step Resolution Procedure
Use the ZIP Safe Peek scanner above to list archive entries in memory and flag any entry with '../' or double extensions.
In your application extraction logic, verify that canonical resolved destination paths start with the target directory.
Update your unzip utility to modern libraries that automatically strip traversal tokens.
Verification Command or Config Pattern
import path from "path";
function isSafeExtractionPath(targetDir: string, entryName: string): boolean {
const destinationPath = path.resolve(targetDir, entryName);
// Ensure destination path starts with target directory root
return destinationPath.startsWith(path.resolve(targetDir) + path.sep);
}Frequently Asked Remediation Questions
What file formats are vulnerable to Zip Slip?
Any container format supporting path hierarchy, including ZIP, TAR, JAR, WAR, 7z, and APK files.
How does OnChainScans inspect archives safely?
OnChainScans reads the central directory header in browser memory via JSZip without writing any files to disk.
What is a compression ratio bomb?
A zip bomb is a tiny archive (e.g. 42 KB) that expands to gigabytes of data when extracted, crashing the host server via disk or memory exhaustion.
Can double extensions (.pdf.exe) be caught?
Yes. OnChainScans automatically flags files with executable extensions masquerading as documents.
Complementary Diagnostic Scanners
All 34 toolsE-Book (.epub) Structure Scanner
Parses META-INF/container.xml, OPF packaging, and NCX tables of contents to identify orphaned files, broken spine IDs, and unmanifested asset blobs.
Subtitle (.srt/.vtt) Error & Sync Scanner
Validates SubRip (.srt) and WebVTT (.vtt) files for negative intervals, timecode collisions, CPS (characters per second) violations, and UTF-8 BOM corruptions.
SVG Security & Bloat Scanner
Identifies nested <script> tags, onload event handlers, CDATA XML injection vectors, and bloated Illustrator/Inkscape proprietary XML tags.
Related Troubleshooting & RFC Playbooks
How to Fix SPF PermError: 'Too Many DNS Lookups' (RFC 7208)
Resolve the 10-lookup limit that causes receiving mail servers (Gmail, Outlook) to reject your emails.
How to Fix NET::ERR_CERT_AUTHORITY_INVALID SSL Handshake Errors
Repair broken intermediate certificate bundles and establish a trusted X.509 chain of trust.
How to Fix ERR_TOO_MANY_REDIRECTS & Circular Redirect Loops
Diagnose infinite HTTP 301/302 redirects between Cloudflare Flexible SSL, Nginx, and CMS canonical rules.