Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Zip Bomb Protection: How to Keep Devices Safe

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Zip bombs (also called decompression bombs) are small archive files that expand to an enormous size when extracted, potentially filling your hard drive or crashing your system. Protecting your devices means knowing how to spot them, configuring your tools to block them, and handling suspicious archives safely. You don't need special software—just a few settings and habits.

What You'll Need

  • Access to your device's settings (Windows, macOS, Linux, Android, or iOS)
  • An archive manager (built-in or third-party like 7-Zip, WinRAR, or The Unarchiver)
  • An antivirus or security suite (optional but recommended)

Step-by-Step

  1. Understand what a zip bomb looks like. A zip bomb is a small file (often a few kilobytes or megabytes) that contains layers of compressed data. When extracted, it can expand to gigabytes, terabytes, or more. Common signs: the file size is tiny but the archive claims to contain huge files, or the archive has many nested layers.
  2. Configure your archive manager to warn before extracting. Most archive tools have a setting to show the uncompressed size before extraction. For example, in 7-Zip, right-click a zip file and choose "Open archive"—the interface will show the uncompressed size. In Windows File Explorer, the tooltip may show the size. Enable any option that asks for confirmation before extracting large archives.
  3. Set a size limit in your extraction tool. Some tools let you set a maximum uncompressed size. In 7-Zip, you can use the command line to set a limit, but for graphical tools, you can manually check the size before extracting. On Linux, use the unzip -l command to list contents and sizes before extracting.
  4. Use antivirus software with archive scanning. Most modern antivirus programs scan archives for threats, but they may not detect a zip bomb as malware. However, some security suites have heuristics that flag suspicious archives. Ensure your antivirus is up to date and has real-time protection enabled.
  5. Extract to a temporary folder with limited space. If you must extract a suspicious archive, do it in a folder on a drive with little free space, or use a virtual machine or sandbox. On Windows, you can create a small virtual hard drive (VHD) and mount it. On macOS, use Disk Utility to create a small disk image. This contains the explosion.
  6. Use built-in OS protections. On Windows, enable Controlled Folder Access (under Windows Security > Virus & threat protection > Ransomware protection) to prevent unauthorized changes to your files. On macOS, Gatekeeper and Notarization help prevent malicious apps from running, but they don't stop extraction. On Android, be cautious with files from unknown sources—use the built-in file manager's preview feature instead of extracting.
  7. Check the archive's metadata before extracting. Right-click the zip file and look at its properties. If the compressed size is tiny but the "uncompressed size" (shown in some tools) is huge, treat it as a zip bomb. On Windows, you can open the archive with File Explorer and look at the "Size" column—if it shows a massive number, don't extract.
  8. Never extract archives from untrusted sources. This is the simplest rule. If you didn't expect the file, don't open it. If it's from an email, check the sender's address carefully. If it's a download, verify the source.
  9. Use a dedicated extraction tool with built-in protection. Tools like 7-Zip (Windows), The Unarchiver (macOS), and PeaZip (cross-platform) often have options to limit extraction size. For example, in 7-Zip, you can go to Tools > Options > Security and enable "Show file names and sizes" or similar. In PeaZip, you can set a maximum extraction size in the settings.
  10. Keep your operating system and software updated. Updates often include security patches that mitigate denial-of-service attacks, including zip bomb vulnerabilities. Enable automatic updates.

Common Mistakes

  • Extracting without checking the size. Many people double-click and extract immediately. Always check the uncompressed size first.
  • Trusting file extensions. A zip bomb might be disguised as a .rar, .7z, or even a .docx (which is a zip file). Always inspect the archive's contents.
  • Thinking antivirus will catch it. Zip bombs are not malware in the traditional sense; they are a denial-of-service tool. Antivirus may not flag them.
  • Using a shared drive. Extracting a zip bomb on a network drive can fill the server's storage, affecting others. Extract locally and only in a controlled space.

Tips

  • Use a separate extraction folder. Create a folder dedicated to extracting suspicious files, and monitor its size.
  • Learn to inspect archives on the command line. On Windows, PowerShell can list zip contents: Expand-Archive -Path file.zip -DestinationPath temp but first use Get-Item file.zip | Select Length to see the compressed size. On Linux/macOS, use unzip -l file.zip to see the uncompressed sizes.
  • Consider using a cloud service to preview archives. Some cloud storage services (like Google Drive) preview zip contents without fully extracting them, but this is not a guarantee—use with caution.
  • For enterprise environments, use email filtering. Many corporate email gateways block zip bombs based on file size and content analysis.

Troubleshooting

If you accidentally extracted a zip bomb and your drive is full, do not panic. Follow these steps:

  1. Stop any ongoing extraction. If the extraction is still running, cancel it immediately. In Windows, close the archive manager or use Task Manager to end the process. On macOS, force quit the app.
  2. Delete the extracted files. Go to the extraction folder and delete the files. If the folder is too large, use the command line: on Windows, del /s /q folder or use Shift+Delete. On Linux/macOS, rm -rf folder (be very careful with this command).
  3. If the drive is completely full, free space first. Delete other temporary files or move non-essential files to an external drive to make room for the deletion operation.
  4. Check for hidden nested archives. Zip bombs often contain multiple layers. After deleting the first layer, check for other zip files inside and delete them without extracting.
  5. Restart your device. This clears any hanging processes and frees up memory.
  6. If the system is unresponsive, boot into Safe Mode. On Windows, restart and press F8 (or Shift+Restart) to enter Safe Mode. On macOS, restart and hold Command+S for single-user mode (advanced). Then delete the files.
  7. If the damage is severe (e.g., system files corrupted), consider system restore or reinstallation. This is a last resort—back up your important files first.

Frequently Asked Questions

Can a zip bomb damage hardware?

No, a zip bomb cannot physically damage hardware. It only fills storage or exhausts memory, causing a denial of service. However, it can cause data loss if it fills the drive where important files are stored.

How can I tell if a zip file is a bomb without extracting it?

Check the compressed size versus the uncompressed size. If the uncompressed size is extremely large (e.g., the archive is 1 MB but claims to contain 1 TB), it's a zip bomb. Use an archive manager that shows the uncompressed size before extraction.

Do zip bombs work on all operating systems?

Yes, zip bombs work on any system that supports zip extraction, including Windows, macOS, Linux, Android, and iOS. The impact depends on the file system and available storage.

Can antivirus software detect zip bombs?

Most antivirus programs do not detect zip bombs because they are not malware. However, some security suites have heuristics that flag archives with extreme compression ratios. Always use an antivirus, but don't rely on it solely for zip bomb protection.

Is it safe to preview a zip file without extracting?

Previewing (viewing the list of files inside) is generally safe because it does not decompress the contents. However, some file managers may automatically extract thumbnails or metadata—be cautious and use a dedicated archive tool to preview.

What should I do if I receive a zip bomb via email?

Do not download or extract it. Delete the email immediately. If you must report it, forward it to your IT department or email provider's abuse team, but do not open the attachment.