OTP & verification

OTP Security: SIM Swap, Phishing, and When SMS Codes Are Enough

The real risks of SMS one-time passwords, including SIM swap, real-time phishing, and malware, and practical controls that make OTP-based login safer for consumer apps.

Updated · 3 min read

SMS one-time passwords are everywhere, and so are articles saying they are insecure. The truth is in between: SMS OTP is far better than a password alone and is easy for every user, but it has known weaknesses that you should design around.

The main threats

SIM swap. An attacker convinces or bribes someone at a mobile operator to move the victim's number to a new SIM card. From then on, the attacker receives the victim's SMS, including OTPs. Targets are usually people with valuable accounts: crypto, banking, or social media with many followers.

Real-time phishing. A fake login page asks the user for their phone number, triggers a real OTP from your service, and asks the user to type the code into the fake page, which relays it to you immediately. The code is valid, so the attacker gets in.

Social engineering. Someone calls the user pretending to be support and asks them to "confirm" the code they just received.

Malware. Malicious apps on Android can read incoming SMS if granted permission.

Controls that reduce the risk

Make codes harder to misuse:

  • Bind each code to its purpose and phone number, and say what it is for: "Your code to approve a payment of EGP 1,500 is…". A user is less likely to share a code that clearly describes an action they did not start.
  • Add "Never share this code. Acme will never ask for it." to every message.
  • Use origin-bound codes (@yourdomain.com #123456) so browsers only autofill on your real site.

Add risk signals around the OTP:

  • Watch for a recent SIM change. Some operators and providers offer SIM swap checks; where available, they let you step up verification when a SIM changed recently.
  • Compare device, location, and behaviour with the user's history.
  • Delay sensitive changes (new payout account, new phone number) after a new login, and notify the user on another channel.

Use stronger factors where it matters:

  • Offer passkeys or authenticator apps for users who want them.
  • Require them for the highest-risk actions in high-value products.

When SMS OTP is enough

For most consumer apps, SMS OTP with good rate limits, clear message text, and basic risk checks is a reasonable choice, especially for:

  • Signup and phone number verification.
  • Low to medium risk logins.
  • Confirming actions where you also have other signals.

It is often not enough on its own for: large financial transfers, changing account recovery details, or accounts that are frequent targets of SIM swap.

Do not forget abuse of your own endpoint

Security is also about protecting yourself. An OTP endpoint without limits can be used to send thousands of messages at your expense; see SMS pumping prevention.

A balanced setup

  1. SMS OTP for signup and everyday login, with strict rate and attempt limits.
  2. WhatsApp as an alternative channel. See WhatsApp OTP vs SMS OTP.
  3. Step-up checks for sensitive actions.
  4. Passkeys offered to users who want stronger security.

For the basics, see OTP best practices.