At a glance
- Controls
- CWE-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.
- 01Read the code to find where uploaded archives or compressed formats are unpacked
- 02Sign in with the test login and upload a small, harmless archive with a high but safe expansion ratio
- 03Confirm whether the product checks unpacked size, stopping well below any level that could affect the service
Uploads must be limited in size after decompression.
Executable checkas 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
- 01
Track total bytes written while unpacking and stop at a set limit
- 02
Limit the number of files and the depth of nested archives
- 03
Unpack in an isolated worker with its own disk and memory limits
- 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? →