Course contentsShow
← Security
Lesson 951 of 3,05220. Web Security - File Upload and ProcessingFree lesson

Archive and Compressed File Attacks

Exploiting zip/tar upload processing including zip bombs, path traversal within archives, and symlink attacks.

Archive and Compressed File Attacks

What you'll learn: How attackers exploit file upload features that process archives (ZIP, TAR, etc.) to cause denial-of-service, traverse directories, or compromise systems through malicious archive contents.

The Core Problem

When web applications accept and extract archive files (ZIP, TAR, GZ), they introduce a hidden attack surface. The extraction process itself becomes exploitable—attackers craft malicious archives that abuse the decompression logic rather than just uploading a single dangerous file.

Think of it like a Trojan horse: you're not just checking what's being delivered, but how it unpacks once inside your walls.

Key Archive-Based Attacks

Zip Bombs (Decompression Bombs)

A tiny ZIP file (kilobytes) that expands to gigabytes or terabytes when extracted. Like a compressed spring, it overwhelms disk space, memory, and CPU during decompression, causing denial-of-service.

Example: A 42KB zip that unpacks to 4.5 petabytes through recursive compression layers.

Path Traversal in Archives

Archive entries with filenames like ../../../etc/passwd or ..\..\..\windows\system32\config can write files outside the intended extraction directory when processed naively. An attacker overwrites critical system files or places web shells in executable directories.

Symlink Attacks

Archives containing symbolic links pointing to sensitive system paths (/etc/shadow, /var/www/html/shell.php). When extracted with preserved permissions, these symlinks can:

  • Trick the application into reading sensitive files through the symlink
  • Overwrite critical files if the extraction follows symlinks during write operations

Why This Matters

Applications that automatically extract uploads for processing—document parsers, backup systems, package managers—are particularly vulnerable. The archive format provides a layer of indirection that bypasses simple file type checks.

Key Takeaway: Archive uploads introduce complex attack vectors through decompression bombs, path traversal via crafted filenames, and symlink exploitation—requiring strict validation of archive contents, extraction paths, and resource limits during processing.