CWE-409AvailabilitySeverity · Medium

Archives that expand without limit

A small uploaded archive can unpack into gigabytes of data. Without a limit on the unpacked size, one upload can fill the disk or memory and stop a service.

At a glance

Controls
CWE-409
Typical severityMedium
ReferenceCWE-409

What it is

Compressed files can be built so that a few kilobytes expand into gigabytes. If a product unpacks uploads without tracking the size it is writing, the disk or memory fills up. Nested archives make the effect far larger.

An attacker uploads one crafted archive wherever the product accepts files. The unpacking job runs out of space or memory, and other work on the same machine fails with it. AI tools can generate these files on request and find every upload path in the code quickly.

Where it hides

What a reviewer can look for in the code and in the behaviour, before anyone proves it.

  • Bulk import features that accept ZIP files
  • Document and spreadsheet uploads, since many office formats are ZIP archives
  • Background jobs that unpack attachments or backups
  • Image and file processing pipelines that decompress data

How MATT tests it

The proof runs against the deployed product, on every release, whoever wrote the code.

  1. 01Read the code to find where uploaded archives or compressed formats are unpacked
  2. 02Sign in with the test login and upload a small, harmless archive with a high but safe expansion ratio
  3. 03Confirm whether the product checks unpacked size, stopping well below any level that could affect the service
The rule, in plain English

Uploads must be limited in size after decompression.

Executable check

as any user: POST /v1/imports with an archive that expands past the allowed limit expect: 400 or 413 expect: unpacking stops once the limit is reached expect: no files left behind from the rejected upload

Every rule MATT holds →

What the fix looks like

  1. 01

    Track total bytes written while unpacking and stop at a set limit

  2. 02

    Limit the number of files and the depth of nested archives

  3. 03

    Unpack in an isolated worker with its own disk and memory limits

  4. 04

    Check the compression ratio of each entry and reject extreme ones

A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →

ExploitOps discovery call

Understand where your security loop breaks.

A call with a MATT co-founder to understand your product and whether an ExploitOps Review is worth doing. If there is a real need, we scope one with the research team.

Let’s understand your priority

What brings you to MATT?

What would you like help with?
01 / 02