No Rate Limiting on API Endpoints
API endpoints accept an unlimited number, rate or size of requests from a single client, which allows resource exhaustion, guessing attacks, data harvesting and runaway costs.
| Severity | Medium |
| CVSS 3.1 | 5.3 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:L Open in the calculator |
| CVSS 4.0 | 6.9 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-770: Allocation of Resources Without Limits or Throttling |
| MITRE ATT&CK | T1499.003 Application Exhaustion Flood, T1110 Brute Force |
| Category | Insecure Design |
Description
The API does not limit how many requests a client, user, API key or source address can make in a period, or how much work a single request can cause, so every request is processed in full regardless of volume. The weakness shows itself in several ways:
- no request rate limit, so a script can send thousands of requests a minute without receiving
429 Too Many Requestsor being slowed down, which lets an attacker degrade or interrupt the service for other users, harvest data at scale through listing and search endpoints, and guess values that are only safe when attempts are limited, such as one-time codes, reset tokens, voucher codes or identifiers; - no limit on the work per request, such as page size parameters that accept very large values, unbounded exports and searches, bulk operations with no cap on the number of items, or uploads with no size limit, so a few very expensive requests can have the same effect on the service as large volumes;
- no limit on operations that cost money, such as sending SMS messages or emails, calling paid third-party services or generating reports, through which the organisation can incur significant costs.
The typical impact is limited disruption and abuse rather than direct data compromise, but it rises where a guessable secret or an expensive operation is exposed. The weakness is identified by sending bursts of requests to representative endpoints, including verification code, search, export and other resource-intensive operations, and observing whether any are rejected, delayed or blocked, and by testing parameters that control the amount of work, such as page size, with large values. Testing is normally kept to modest volumes that show the absence of limits without degrading the service. Limits on password guessing at sign-in are covered by a separate finding.
Remediation
Apply limits at several levels, starting at the edge:
- Enforce rate limits per client identity (user, API key or token) and per source address at the API gateway, load balancer or reverse proxy, with stricter limits on sensitive and expensive operations, and return
429 Too Many Requestswith aRetry-Afterheader when they are exceeded. - Limit the work per request: a maximum page size enforced on the server, caps on bulk operations, maximum request body and upload sizes, and timeouts on long-running queries.
- Apply quotas and spending limits to operations that cost money, such as a maximum number of messages per user per day.
- Monitor request rates and alert on unusual patterns.
Most platforms provide the controls, such as rate limiting policies in Azure API Management, throttling and usage plans in Amazon API Gateway, the rate limiting middleware in ASP.NET Core, and the limit_req module in nginx:
Set the limits from observed legitimate usage. Confirm the fix by repeating the burst tests and checking that excess requests are rejected, and that oversized page and body values are refused or capped.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.