Bot Attacks on a Mobile App: A Script Is Hitting Your Login Endpoint

A script tries 8,000 passwords a minute against your login API at 3am. Rate limiting, smart lockout and Defender for Cloud make speed the losing move.

Suthahar Jegatheesan By Suthahar Jegatheesan Published

Azure 4 min read —views
Article banner. On the left, the eyebrow "Azure, Securing a Mobile App" above the title "8,000 tries a minute" and the line "Nobody is typing. Make speed the losing move.", with the MSDEVBUILD wordmark and the author name below. On the right, three stacked boxes joined by arrows: a grey box reading "A script at 3am, against your login API", an arrow labelled "the attack" to an amber box reading "Rate limit per user or IP, years, not hours", and an arrow labelled "the rest" to a green box reading "Lockout, MFA, an alert, Azure is awake instead".

It’s 3:12am. Nobody on your team is awake, and your login endpoint is taking 8,000 requests a minute.

Nobody is typing them. A script is.

Automated attacks are a different problem

They’re not clever. They’re fast, cheap and patient. A script downloads your app, unpacks it, lists every endpoint it can find, and starts working through password lists leaked from other companies’ breaches. It runs at 3am precisely because that’s when nobody responds.

So every part of your defence has to assume nobody is awake. Three controls do that, in order of how much they change the outcome:

Five steps with icons. 1, in red: a bot tries 8,000 passwords a minute from a server at 3am, calling your API directly. 2, Front Door drops the obvious flood at the edge. 3, a speedometer: your API allows 10 tries a minute per person, so real users never notice. 4, a padlock: Entra ID locks the bot out and asks for MFA, so even a correct guess is not enough. 5, a bell: an alert wakes a human when failed logins spike. A green box at the end reads "10 tries a minute: the password list now takes years."

Figure 1 — four controls that turn 8,000 guesses a minute into ten.

How does rate limiting stop a bot?

It takes the speed away, and speed is the only advantage the bot has. At 8,000 tries a minute, a password list is done in hours. At 10 a minute, it takes years, and the attacker goes looking for an easier target.

ASP.NET Core has this built in:

builder.Services.AddRateLimiter(o =>
    o.AddFixedWindowLimiter("login", w => {
        w.PermitLimit = 10;
        w.Window = TimeSpan.FromMinutes(1);
    }));

In Azure API Management, the equivalent is rate-limit-by-key keyed on the subscription or caller IP. Front Door WAF also has a rate-limit rule, and blocking at the edge costs you nothing at all: that’s the outermost layer in the five-layer request flow.

What smart lockout and MFA add

They make a correct guess useless. Microsoft Entra ID’s smart lockout is on by default and knows familiar locations from unfamiliar ones, so it can lock out the bot without locking out Priya on her usual phone. Add MFA through Conditional Access and a right password on its own stops being enough.

Credential stuffing only works because people reuse passwords. MFA is what makes that reuse survivable.

What to alert on

The rate of 401 and 403 responses, not individual errors. A sudden spike in 401s is somebody trying credentials, and it’s the earliest signal you’ll ever get. Wire the alert to a phone, not an inbox. An inbox at 3am is no alert at all.

Why doesn’t a CAPTCHA help?

This is the most common mistake. A CAPTCHA protects a web form. The bot isn’t using your web form. It’s calling the same API your app calls, straight from a server, and it never renders a single pixel of your UI. The control has to live at the API.

One small thing worth doing

Return the same response, and the same timing, for “no such user” and “wrong password”. If those differ, the script can work out which of your users exist, and a list of real accounts is worth more to an attacker than the guesses.

Key takeaways

  • Automated attacks win on volume and persistence, not cleverness — design as if nobody is awake.
  • Rate limiting, partitioned per user or IP, is the control that changes the economics of the attack.
  • Entra ID smart lockout plus MFA neutralises a correct guess, which rate limiting alone can’t.
  • Alert on the rate of 401/403s, and send it to a phone.
  • A CAPTCHA protects a UI the bot never uses; the real control belongs at the API.

Official documentation: Entra smart lockout and API Management rate limiting.

Earlier in this series: Azure Key Vault Explained: The One Secret Tutorials Never Remove and Secure a Mobile API in Five Steps: The Order Is the Whole Point.

Test yourself · 5 questions

Check what you learned

Answer the questions, then submit to see your score and the explanations. Each question is tagged with the certification exam that covers the skill: SC-500, SC-900.

  1. SC-500 Secure compute

    1. A script tries 8,000 passwords a minute against your mobile login API. Which control changes the economics of the attack the most?
  2. SC-500 Secure compute

    2. Why does a CAPTCHA do nothing against this bot?
  3. SC-900 Describe the capabilities of Microsoft Entra

    3. The bot finally guesses a correct password for one user. What makes that guess useless?
  4. SC-500 Manage identity, access, and governance

    4. What should the login endpoint return for 'no such user' compared with 'wrong password'?
  5. SC-500 Manage and monitor security posture

    5. What is the earliest monitoring signal that a credential-stuffing attack is under way?
0 of 5 answered

Your result

These are practice questions written from this article, not questions taken from a real exam. Exam tags follow the skills listed in each exam's official study guide on Microsoft Learn.

Was this useful?

Share

Found a mistake or an outdated step? Edit this page on GitHub

Frequently asked questions

How do you stop a credential-stuffing bot attacking a mobile app login?
Three controls, in order of effect: rate-limit the login endpoint per user or IP so the attack slows from thousands of attempts a minute to ten, rely on Microsoft Entra ID smart lockout plus MFA so a correct guess is still useless, and alert on the rate of 401 and 403 responses through Defender for Cloud and Azure Monitor.
Why does a CAPTCHA not stop automated attacks against a mobile API?
A CAPTCHA protects a web form, but the bot is not using your web form — it is calling the same API your mobile app calls, directly from a server. Any control aimed at automated attacks has to live at the API layer itself, because the attacker never touches the UI.
What rate limit stops a credential-stuffing bot without affecting real users?
A low per-caller limit, such as ten attempts per minute, partitioned by user or IP rather than applied globally. At thousands of attempts a minute a password list is exhausted in hours; at ten a minute it takes years. A real user retrying a login is never affected.
Should a login endpoint return different responses for "wrong password" and "no such user"?
No, and that includes response timing, not just the message. Different responses let a script work out which accounts exist, and a confirmed list of real accounts is worth more to an attacker than the password guesses themselves.
Article banner. On the left, the eyebrow "Azure, Securing a Mobile App" above the title "Same app, two architectures" and the line "Both work on day one. Only one can be patched.", with the MSDEVBUILD wordmark and the author name below. On the right, three stacked boxes joined by arrows: a grey box reading "App to database, a connection string inside", an arrow labelled "day 30" to a red box reading "Every fix is an app release, days, behind a review", and an arrow labelled "rebuilt" to a green box reading "App to API to private SQL, every fix is a server change".

Next in this series · Part 9 of 10

5 min

Insecure vs Secure: The Same Mobile App, Two Azure Architectures

Both architectures work perfectly for a real customer. They only differ at six moments — and one of the two designs cannot be patched, only rebuilt.

Continue the series
Part 7 of 10Azure Key Vault Explained: The One Secret Tutorials Never Remove

Get new posts by email

New technical articles, Azure AI and GitHub Copilot updates, and upcoming events. No spam, unsubscribe anytime.

Comments

Your turn

How did Suthahar's articles help you?

If something here saved you time or unblocked a real project, I'd love to hear about it. Submissions are reviewed before they appear on the site.

0/1500 · minimum 10 characters

Never published — used only to verify your feedback.

Your name, company, and role appear publicly if published. Nothing else is collected.

↑↓ navigate ↵ open