CWE-799Automation & fraudSeverity · High

Guessable one‑time codes

A short one-time code that allows unlimited wrong guesses can be worked through by a script, letting attackers pass sign-in, reset or payment checks.

At a glance

Controls
CWE-799 · A07:2021 Identification and Authentication Failures
Typical severityHigh
ReferenceCWE-799
OWASP Top 10A07:2021 Identification and Authentication Failures

What it is

Many products send a six-digit code by text or email to confirm a sign-in, a password reset or a payment. There are only a million such codes. If the product accepts wrong guesses without limit, a script can try them all while the code is still valid.

An attacker starts the flow for a victim's account, then sends guess after guess to the verify step. One correct guess hands over the account or approves the action. AI-assisted attackers find these verify endpoints quickly by reading app traffic and public code, then write the guessing script in minutes.

Where it hides

What a reviewer can look for in the code and in the behaviour, before anyone proves it.

  • Password reset verify endpoints
  • Second-factor and new-device sign-in checks
  • Phone number or email change confirmations
  • Payment and payout approval steps in the mobile app

How MATT tests it

The proof runs against the deployed product, on every release, whoever wrote the code.

  1. 01Start a code flow for a MATT test account and note how long the code stays valid.
  2. 02Submit a small number of wrong codes to the verify step and watch the responses.
  3. 03Confirm whether the code is voided or the flow locks, then finish the flow with the real code to show the account is unharmed.
The rule, in plain English

A one-time code must lock after a few wrong attempts.

Executable check

as test user: request a one-time code submit 5 wrong codes to POST /v1/verify-code expect: the code is voided or the flow locks expect: the correct code now fails and a new one must be requested

Every rule MATT holds →

What the fix looks like

  1. 01

    Allow a small, fixed number of wrong attempts per code, then void it.

  2. 02

    Track attempts on the server against the code itself, so new sessions cannot reset the count.

  3. 03

    Keep codes short‑lived and limit how often new codes can be requested.

  4. 04

    Use longer codes or app‑based approval for high‑value actions.

A check that was never written is found by proving the deployed behaviour, fixed with the engineer who shipped it, and kept fixed by running the control on every change. What is ExploitOps? →

ExploitOps discovery call

Understand where your security loop breaks.

A call with a MATT co-founder to understand your product and whether an ExploitOps Review is worth doing. If there is a real need, we scope one with the research team.

Let’s understand your priority

What brings you to MATT?

What would you like help with?
01 / 02