CWE-770AvailabilitySeverity · Medium

Expensive work on demand

PDF, image or report generation that runs on every request with no queue or limit lets one user use up the servers. Others then face slow pages or outages.

At a glance

Controls
CWE-770
Typical severityMedium
ReferenceCWE-770

What it is

Some features do heavy work each time they are called, such as building a PDF, resizing an image or running a large report. If every request starts that work at once, the cost lands on the same servers that answer everyone else. There is often no cap on how many a single user can start.

An attacker finds the heaviest feature and calls it again and again in parallel. Processors and memory fill up and the whole product slows down. Where the work uses paid services, the bill also climbs. AI tools can spot these endpoints from the code and script the calls quickly.

Where it hides

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

  • Invoice, statement and report PDF generation
  • Image resizing and thumbnail endpoints that take size parameters
  • Data exports and analytics reports
  • Features that call paid external APIs, including AI models

How MATT tests it

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

  1. 01Read the code to find endpoints that run heavy work inside the request
  2. 02Sign in with the test login and call one such endpoint a small number of times in parallel
  3. 03Record whether the product queues or refuses extra calls, and stop before load could affect other users
The rule, in plain English

Expensive operations must be queued and limited per user.

Executable check

as one user: POST /v1/reports/generate 20 times at once expect: 202 with a job id, or 429 once the per-user limit is hit expect: no more than the allowed number of jobs running for that user expect: other users' requests keep normal response times

Every rule MATT holds →

What the fix looks like

  1. 01

    Move heavy work to a background queue with a fixed number of workers

  2. 02

    Limit how many jobs each user and organisation can run at once

  3. 03

    Cache results for identical requests

  4. 04

    Cap input sizes such as page counts and image dimensions

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