Decompression Bombs & DoSRutvij Khatri•9 min read•Published 2026-10-14

Image Decompression Bombs: Preventing Pixel Flood Denial of Service (DoS) Attacks

Learn how malicious 50KB image files expand into 50 gigabytes of uncompressed RAM during decompression, crashing web servers and backend worker queues.

Executive Verdict & Direct Answer
✓ 100% Client-Side In-Browser Engine

Learn how malicious 50KB image files expand into 50 gigabytes of uncompressed RAM during decompression, crashing web servers and backend worker queues. A tiny 100KB PNG file can require over 7GB of uncompressed memory during decoding. Without strict dimension limits, servers crash instantly.

The Mechanics of a Pixel Flood Attack

Most developers understand the danger of "ZIP bombs" (like 42.zip, where a tiny compressed archive expands into petabytes of data). However, a lesser-known yet equally devastating attack vector is the "Image Decompression Bomb" or "Pixel Flood Attack."

Compressed image formats like PNG and GIF employ DEFLATE compression (LZ77 and Huffman coding). Highly repetitive patterns (such as a solid white canvas of 50,000 x 50,000 pixels) compress down to an extraordinarily small file—often under 100 kilobytes on disk.

When an image processing library (like ImageMagick, Pillow, or Sharp) ingests this file to generate a thumbnail, it must allocate an uncompressed raw bitmap in memory: `Width × Height × Channels × BitDepth`. For a 50,000 x 50,000 24-bit image, that requires: `50,000 × 50,000 × 3 bytes ≈ 7.5 Gigabytes` of continuous RAM allocation.

Uploading ten such images concurrently instantly triggers Linux Out-Of-Memory (OOM) killer routines, taking down web applications and neighboring containers.

Key Investigative Takeaway

A tiny 100KB PNG file can require over 7GB of uncompressed memory during decoding. Without strict dimension limits, servers crash instantly.

Header Spoofing vs. True High-Dimension Bombs

Image decompression attacks fall into two categories:

1. Compressed High-Dimension Bombs: Truly contain billions of identical pixels that compress efficiently.

2. Header Dimension Spoofing: The attacker manually alters the `IHDR` width and height headers to claim huge dimensions (e.g. `65535 × 65535`). Naive libraries allocate the memory buffer before reading the pixel stream, causing immediate exhaustion.

Auditing Images with OverlayCheck

OverlayCheck parses image headers without triggering raster buffer allocation, calculating the exact required uncompressed RAM footprint in bytes, gigabytes, and warning administrators if the file exceeds safe operational thresholds.

Decompression Defense Mechanisms

Assessing resilience against memory exhaustion and OOM crashes.

Feature / DimensionOverlayCheck (Client-Side)Unprotected Image Processing (Default)Strict Dimension & Memory Limits
Memory Exhaustion Protection
Pre-flight header calculation before allocation
Vulnerable (Allocates full buffer and crashes)Safe (Rejects files exceeding dimension caps)

Command-Line Automation & CLI Workflows

For security engineers and forensic examiners automating pipelines or conducting terminal audits, the equivalent low-level commands can be executed natively:

Check Pixel Dimensions and Projected RAM via ImageMagick
bash
identify -format "Dimensions: %w x %h | Projected RAM: %[fx:w*h*4/1048576] MB\n" bomb.png
Technical Breakdown: Reads only the image header metadata to compute dimensions and calculate the uncompressed RGBA RAM footprint in megabytes without decoding pixels.

Frequently Asked Technical Questions

Q1:What is a safe maximum image dimension threshold for web apps?

Most consumer web applications enforce a strict cap of 4,096 x 4,096 pixels (or approximately 50MB of raw uncompressed memory) to prevent server strain.

#image decompression bomb#pixel flood attack dos#zip bomb image#prevent memory exhaustion image#appsec decompression bomb
RK
Rutvij KhatriSecurity Analyst & Aspiring Security Engineer

Security Analyst and Aspiring Security Engineer passionate about client-side media verification, binary parsing, web application security auditing, CTF steganography challenges, and zero-knowledge privacy architecture.

Connect on LinkedIn

Companion Verification & Privacy Toolkits

Cross-Cluster Workflows

Related Deep Dives in Decompression Bombs & DoS