API4:2023 - Unrestricted Resource Consumption
What you'll learn: How missing rate limits and resource quotas allow attackers to overwhelm APIs through denial-of-service attacks and resource exhaustion.
The Core Problem
APIs without proper resource consumption controls are like all-you-can-eat buffets with no time limits or plate restrictions. Attackers can request unlimited resources, overwhelming your servers and denying service to legitimate users—or racking up massive infrastructure bills.
Unlike traditional rate limiting (which you've learned about), unrestricted resource consumption involves multiple attack vectors:
- No execution timeouts - Long-running operations consume server resources indefinitely
- Missing memory limits - Requests that return massive datasets exhaust RAM
- Unlimited file sizes - Users upload gigabyte files without restriction
- No concurrent request caps - One user opens thousands of connections simultaneously
- Missing query complexity controls - Database queries run without resource boundaries
Real-World Attack Scenarios
An attacker might:
- Request paginated data with
?limit=999999999to fetch your entire database in one call - Upload massive files repeatedly to fill disk space
- Execute complex searches or reports that take minutes to complete, tying up threads
- Open WebSocket connections and never close them
- Request bulk operations on thousands of items at once
Think of it as the difference between a library that lets you check out one book at a time versus one that lets you cart out the entire building's collection.
Why This Matters
Even if you have authentication and rate limiting, resource exhaustion can still occur if individual authenticated requests can consume unlimited CPU, memory, bandwidth, or storage. The cost isn't just service degradation—cloud bills can skyrocket from resource abuse.
Key Takeaway: Always implement resource quotas at multiple layers—request size limits, execution timeouts, pagination caps, concurrent connection limits, and query complexity controls—to prevent individual users from monopolizing API resources.