How to prevent account takeover

Intermediate4 min readUpdated

GET /learn/account-attacks/how-to-prevent-account-takeover/ Accept text/html text/markdown

Short answer

Close each way in and limit what an attacker can do once inside. Stop credential stuffing at login with bot detection and breached password checks, offer passkeys or other phishing-resistant MFA, protect account recovery as strongly as login, re-authenticate and notify before sensitive changes, tie sessions to the device, and train support staff to resist social engineering.

An attacker needs only one way in, so prevention means closing each route in turn and then limiting the damage when one still gets through.

Protect every login endpoint

Most takeovers at scale start with credential stuffing. Put bot detection on the login, refuse breached passwords, count failures per account and per device as well as per IP address, and return one error message for every failed login. Apply all of it to the mobile app API, legacy login paths and the OAuth token endpoint, since attackers move to whichever has the fewest checks.

Offer phishing-resistant MFA

Any second factor stops a leaked password from being enough. They differ in what they resist. SMS codes can be intercepted through a SIM swap, and NIST SP 800-63B-4 classes authentication over the phone network as "restricted" (NIST SP 800-63B). Codes from an authenticator app and push approvals can both be phished in real time. Passkeys and other FIDO2 credentials are tied to your domain, so a phishing site cannot use them. Offer passkeys, make them the default where you can, and ask for a second factor on risky logins even for users who have not opted in. Does MFA stop account takeover compares the methods.

Make account recovery as strong as login

Account security is only as strong as the weakest way back in. A passkey with an SMS reset is as strong as SMS. The OWASP Forgot Password Cheat Sheet covers the details. The main points:

  • Send reset links or codes only to the email or phone already verified on the account, and build the link from a fixed domain, never from the request's Host header.
  • Make reset tokens random, single use and time limited. Thirty minutes is a reasonable starting point.
  • Show the same message, with the same response time, whether or not the account exists.
  • Do not log the user in automatically after a reset. Send them through the normal login, with MFA.
  • End other sessions after the reset, or offer the user the choice.
  • Do not rely on security questions. OWASP says they should never be the only way to reset a password, and their answers are often public or guessable.

Re-authenticate and notify before sensitive changes

The first thing a successful attacker does is change the email, phone number, password or MFA settings so the owner cannot get back in. Ask for the password or a passkey, plus a second factor where enrolled, before any of these changes, and before adding a payout account or shipping address. Send a notice to the old email address or phone number with a link to reverse the change. For payout changes, a waiting period helps: as a starting point, hold the first payout to a new bank account for 24 hours and tell the user why.

Watch sessions after login

A stolen session cookie skips login and MFA entirely. Keep sessions short for sensitive areas, record the device and network each session was issued to, and ask for re-authentication when a session suddenly shows up on a different device. Give users a list of their active sessions with a way to end them. The detail is in session hijacking and cookie theft.

Train the support desk

Attackers who cannot get past your login call or chat with support instead, armed with the victim's name, address and recent orders. Support staff should never change an email address or phone number based on personal details alone. Verify through the existing channels on the account, such as a code sent to the current email, and flag accounts whose contact details changed in the last few days so the next agent sees it.

Prepare the response

When you confirm a takeover, end all sessions, reset the password, remove any MFA methods the attacker added, restore the original contact details and reverse orders or payouts where you can. Then search for the same device fingerprint, IP range or payout details on other accounts, since takeovers rarely come alone. The patterns to search for are listed in signs of account takeover. Depending on what the attacker could see, you may also have legal duties to report a personal data breach, so involve your privacy or legal team.

Tools that help

StopBots is published by Kairal, which is one of the tools listed. The list is not a ranking.

  • SimpleWebAuthn is a set of open-source TypeScript libraries for adding passkeys to a site and its Node.js backend, enough for a small team to ship phishing-resistant login.
  • Pwned Passwords is a free API for refusing breached passwords at signup, password change and reset.
  • Arkose Labs combines risk detection with challenges to stop bots and account takeover at login and signup.
  • Kairal connects device, network and behavioural signals across the customer journey, from first visit to login and checkout, to detect account takeover, and its preview mode shows what it would block before you turn on enforcement.

Common questions

How do you prevent account takeover fraud in ecommerce?

Focus on the actions that turn an account into money. Re-authenticate before a new shipping address or card is added, hold orders of resellable goods to a new address after a new-device login, and put a step-up check in front of gift card and loyalty balance spending.

Does a password manager prevent account takeover?

It helps, because unique passwords for every site remove the reuse that credential stuffing depends on, and most password managers will not autofill on a domain that does not match. It does not protect against malware that steals session cookies.

What is account takeover monitoring?

It means watching account activity after login for signs that someone other than the owner is in control, such as a new device followed by contact detail changes, and stepping in before value leaves the account.