Rate limits people get around
Step 1 · The pattern
Upload your contacts, find your friends
A user uploads their phone's contacts. The contact matcher checks each number and returns the friends who are already members. It answers one simple question: is this number one of ours? (All numbers are illustrative.)
- a contact lookup
- a friend found
In short
Rate limits people get around: how it works and how it breaks
Rate limits are usually set per account or per IP address: one client may make so many requests a minute. That stops a single runaway script, but an attacker scraping your data is patient and cheap to multiply: hundreds of accounts, thousands of addresses, each comfortably under the limit. Lookup features suffer most. 'Find friends from your contacts' or 'does this email have an account?' answer exactly one question each, and asked millions of times with made-up inputs they turn into a directory of your users. The fix combines limits: per account and per device, plus a budget for the whole system on the expensive or revealing operation, and signals no real user produces, such as sequential phone numbers, thousands of never-seen numbers per account, or software imitating your app. Reveal less too: only match people who chose to be findable.
What this simulation simplifies
- The attacker uses four accounts here; real campaigns use thousands, plus rotating addresses.
- Detection is a flag; real systems combine many signals and adjust over time.
How this comes up in interviews
"Your 'check if an email is registered' endpoint is being scraped from thousands of IPs. What do you do?"
Then they ask
- Why is per-IP limiting not enough?
- How do you avoid hurting real users?
- Should the endpoint exist at all?
A strong answer covers
- Per-IP and per-account limits are trivially spread across many clients.
- Add a global budget on the operation and per-resource counters.
- Detect patterns: sequential inputs, never-seen inputs, client fingerprints.
- Reduce what the response reveals; require opt-in for being findable.
- Keep limits in a shared store so they hold across servers.
Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.
On one page: the track cheat sheet.
Sources: OWASP API Security Top 10 (2023): API4 Unrestricted Resource Consumption ↗ · Meta newsroom: The Facts on News Reports About Facebook Data (6 Apr 2021) ↗ · Report a problem
Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.