API rate limit and user enumeration review
Brief
A rate limit keyed only on the source address stops one machine, and one keyed only on the account stops one target; sensitive endpoints need both. The review takes the limits the client says it configured and verifies each with a handful of requests against test accounts, never with volume.
On this page
- Check first
- Is the login limit keyed on the account, the source, or both?
- Do reset and code send endpoints limit what they send?
- Do lookup endpoints answer differently for unknown users?
- Are object ids sequential, and does a missing id answer differently from a forbidden one?
- The defender sees
- Done when
- Not covered
- Tools
- Related research
- Reviewed
- Situation
- The API's route list, two test accounts we may lock, and the thresholds the client says are configured on each sensitive endpoint, since knowing the limit lets us test at the limit plus one instead of searching for it. Every login, reset and code request names a test account or a test mailbox and phone number the client issued, every request is counted and stated, and only the APIs the scope letter names are tested. A second source address, agreed in the scope letter, is used for the per-account check.
- Goal
- A table of sensitive endpoints with the configured limit, the key it counts by (account, source or both), the result at the limit plus one, and whether the endpoint answers alike for existing and missing users.
- Outputs
- Captured on 4 Nov 2026 against the Atarus Bench Web and API lab fixture, edition
web-api-0.2, running on loopback, with one origin playing every host, renamed to the example domains and printed ashttps(the lab ran plainhttp). The second-source login request stays representative: the fixture listens on loopback, which has only one source address.
Check first
- Every endpoint that checks a secret or sends one: login, password reset, one-time code send and check, magic link, and API key exchange, on every API version and on the mobile routes.
- Every endpoint that looks something up by email, phone, username or id, including invite, sign-up and share dialogs.
- The configured limit on each, from the gateway or WAF configuration, and what it counts by.
- Two test accounts that may be locked, and who unlocks them.
- Whether a refusal is logged with the account, the source and the rule that fired.
Steps
Is the login limit keyed on the account, the source, or both?
for i in 1 2 3 4 5 6; do
curl -s -o /dev/null -w "$i %{http_code}\n" -X POST https://api.example.com/v2/login \
-H 'Content-Type: application/json' -d "{\"email\":\"tester-a@test.example\",\"password\":\"Wrong-$i\"}"
done
Expected output
1 401
2 401
3 401
4 401
5 401
6 429 # <- the sixth failure is refused from this source
Then one request for the same account from the second agreed source:
curl -s -o /dev/null -w 'second source %{http_code}\n' --interface "$SECOND_SOURCE_IF" -X POST \
https://api.example.com/v2/login -H 'Content-Type: application/json' \
-d '{"email":"tester-a@test.example","password":"Wrong-7"}'
Expected output
second source 401 # <- the account is still accepting guesses from a new address
The client said five failures per account in fifteen minutes, so six requests prove it. The seventh, from the second source, shows whether the counter belongs to the account or to the address. A limit by address alone does nothing against guesses spread over many addresses.
Negative result. The seventh request refused with 429 or a lock message, from either source.
Fix. Count failures per account and per source, each with its own threshold, and slow or lock the account side in a way that does not let a stranger lock out every user (a delay that grows, or a lock released by the user's own reset).
Do reset and code send endpoints limit what they send?
for i in 1 2 3 4; do
curl -s -o /dev/null -w "$i %{http_code}\n" -X POST https://api.example.com/v2/otp/send \
-H 'Content-Type: application/json' -d '{"phone":"+15555550142"}'
done
Expected output
1 202
2 202
3 202
4 202 # <- a fourth text to the same number in one minute; each one costs the client money
+15555550142 is the client's test number. An unlimited send endpoint costs money for every message and can be pointed at premium rate numbers, so the limit belongs on the number, the account and the source. We send four and count what arrives in the test inbox or phone.
Negative result. A 429 by the third or fourth request, and only the allowed number of messages received.
Fix. Limit sends per destination, per account and per source, block destinations the business never serves, and alert on send volume per hour against a baseline.
Do lookup endpoints answer differently for unknown users?
for e in tester-a@test.example no-such-user-4c1e@test.example; do
curl -s -w " %{http_code}\n" -X POST https://api.example.com/v2/invites/check \
-H "Authorization: Bearer $TESTER_B_TOKEN" -H 'Content-Type: application/json' -d "{\"email\":\"$e\"}"
done
Expected output
{"status":"already_member_elsewhere"} 200 # <- confirms the address has an account in another organization
{"status":"invitable"} 200
The login page often answers alike while the invite, sign-up or share dialog does not. Two requests per endpoint, one for a test account and one for an address that cannot exist, are enough to compare status, body and size. The authentication page covers timing on login.
Negative result. The same body for both, with any difference handled out of band, such as an email to the address.
Fix. Answer every lookup the same way whatever the account state, and move the difference into a message sent to the address itself.
Are object ids sequential, and does a missing id answer differently from a forbidden one?
for n in 1 2; do
curl -s -X POST https://api.example.com/v2/projects -H "Authorization: Bearer $TESTER_A_TOKEN" \
-H 'Content-Type: application/json' -d "{\"name\":\"enum-test-$n\"}" | jq -r .id
done
for id in 98765432 "$TESTER_B_PROJECT_ID"; do
curl -s -o /dev/null -w "$id %{http_code}\n" "https://api.example.com/v2/projects/$id" -H "Authorization: Bearer $TESTER_A_TOKEN"
done
Expected output
10431
10432 # <- consecutive ids reveal volume and every neighbour's id
98765432 404
10388 403
Two objects created in a row show the pattern. We then ask for one id far outside the range and for tester-b's test project: a missing id returning 404 while tester-b's object returns 403 is a difference that tells anyone which ids exist without reading them.
Negative result. Random identifiers, and the same 404 for a missing object and one owned by someone else.
Fix. Use random identifiers in URLs, keep the ownership check anyway (see IDOR testing), and return 404 for both missing and forbidden objects.
The defender sees
Six failed logins on one test account, a seventh from a second address, four code sends to one number, and a handful of lookups. A gateway that logs the rule that fired shows the 429s; the second source's request is the line that should have raised an alert and usually does not, because each address looks quiet on its own. The send endpoint should show up in a per-number count. If refusals are not logged with the account they were for, that goes in the report.
Done when
Login, reset, code send and every lookup by id or email have been tested at their stated limit plus one from one source, the account limit has been checked from the second source, unknown and known users compared on each, and id patterns recorded.
Not covered
Login timing enumeration, session handling and code attempt limits in depth (see authentication and session testing), password spraying, and load testing.