Skip to main content
Security guideReviewed

MFA bypass: the paths around a second factor, and how to test each one

A second factor means a stolen password is not enough on its own, but only on the paths that ask for it.

This guide explains how second factors are relayed, fatigued and gone around through enrolment, recovery, remembered devices and older sign-in routes, what the standards ask for at each step, and how to test your own application. It comes with a test matrix organised by state change and a Node.js lab with a time-based one-time password checked against the RFC test values.

MFA test matrix and local TOTP lab

An illustration on invented accounts. Part 1 is a test matrix organised by state change: enrolment, sign-in with the second factor, changing or removing a factor, recovery, remembered devices, push approval with number matching, and reauthentication for sensitive actions, with steps, the expected result, the evidence to keep and the source behind each expectation.

How to use it

Parts 2 to 6 are a Node.js lab with no installs: a time-based one-time password checked against the RFC test values, a sign-in service in a careless and a careful version, a runner that prints a result per matrix row, and a regression test that fails on the careless version. For an application you own or are authorised in writing to test.

mfa-security.txt

Introduction4 lines

MFA ENROLMENT, RECOVERY AND REMEMBERED-DEVICE TEST MATRIX, WITH A LOCAL LAB An illustration, for testing an application you own or are authorised in writing to test. Written and run on: Node.js 26.0.0 on an Apple M3 Max machine (macOS, arm64). The lab imports only node:http, node:crypto, node:test and node:assert, and installs no packages. Every output below was copied from that run by a script; the per-test timings will differ on your machine. The two accounts are invented, and their passwords end in not-real. Authenticator secrets, recovery codes and device tokens are random values the lab makes in memory on each run and never prints, and the only fixed key is the RFC test key. The lab talks only to its own server on 127.0.0.1.

What MFA bypass means

Multi-factor authentication asks for proof of two different kinds before it lets someone in.

OWASP's Multifactor Authentication Cheat Sheet defines it as evidence from at least two distinct authentication factors: something you know, something you have and something you are. It says requiring two instances of the same factor, such as a password and a PIN, does not constitute MFA, and that the factors should be independent of each other and not able to be compromised by the same attack.

Location and other risk signals can inform the decision, the cheat sheet adds, but do not substitute for a factor.

NIST SP 800-63B-4 says the same of fraud indicators such as an unexpected geolocation: using them does not change the assurance level of a sign-in or substitute for an authentication factor.

What the second factor adds is a limit on what a stolen password is worth. CISA's fact sheet on phishing-resistant MFA, dated October 2022, puts it this way: with MFA enabled, if one factor, such as a password, becomes compromised, unauthorised users will be unable to access the account if they cannot also provide the second factor.

The same fact sheet says not all forms of MFA are equally secure, and that attacks on some forms, through phishing, push bombing, SS7 protocol vulnerabilities or SIM swaps, may let a threat actor gain access to MFA credentials or bypass MFA.

In this guide, MFA bypass means getting into an account that has a second factor without that factor being checked at the moment it matters. It happens in two ways. The factor can be beaten at sign-in: a code relayed through a fake sign-in page, a push prompt approved to make the prompts stop, a text message intercepted, a short code guessed.

Or the factor can be gone around: enrolled by the wrong person, reset through a recovery path weaker than sign-in, skipped by a remembered device, never asked for on an older route, or shown on a page the server does not wait for.

The OWASP cheat sheet says attackers increasingly target weaknesses in MFA deployments and authentication workflows rather than attempting to defeat MFA itself. Every item in both lists has a row in the test matrix on this page.

Neighbouring subjects each have a guide of their own. The authentication failures guide covers sign-up, password sign-in and password reset, including a reset that skips the second factor. The credential stuffing guide covers what a second factor changes when passwords leaked from other sites are replayed.

The session management guide covers the session issued once sign-in finishes, including timeouts and signing out everywhere. The rate limiting guide covers how many attempts each sign-in step allows. The security logging and monitoring guide covers where authentication events are stored and who is alerted.

Phishing and MFA: codes that can be relayed, and factors that cannot

The difference that matters most between second factors is whether a fake sign-in page can pass them on.

NIST SP 800-63B-4, published in July 2025 and focused on authentication to government information systems, defines phishing resistance as the ability of the authentication protocol to prevent the disclosure of authentication secrets and valid authenticator outputs to an impostor verifier without relying on the vigilance of the claimant.

Section 3.2.5 says phishing resistance requires cryptographic authentication, and that authenticators whose output the user types in, such as out-of-band and one-time password authenticators, SHALL NOT be considered phishing-resistant, because typing it in does not bind the output to the specific session being authenticated.

Its example: an impostor verifier could relay an authenticator output to the verifier and successfully authenticate. NIST section 3.1.2 says look-up secrets are not phishing-resistant either, and that a typical application of them is for one-time saved recovery codes.

CISA's phishing-resistant MFA fact sheet gives the everyday version: a user visits a threat actor-controlled site that mimics a company's login portal and submits their username, password and the 6-digit code from their authenticator app. What is taken can be more than the code.

MITRE ATT&CK technique T1539, Steal Web Session Cookie, says session cookies can be used to bypass some multi-factor authentication protocols, and that open source frameworks can gather session cookies through a malicious proxy set up for phishing campaigns.

The OWASP cheat sheet calls this real-time phishing using reverse proxies, and gives two mitigations: monitor for anomalous authentication and session activity, such as impossible travel, a new ASN or sudden MFA method changes, and use phishing-resistant authenticators.

Phishing-resistant factors tie the response to the connection or to the site's name. NIST recognises two methods, channel binding and verifier name binding, and gives WebAuthn, used by authenticators that implement the FIDO2 specifications, as an example of a standard that provides phishing resistance through verifier name binding, by choosing an authenticator secret based on the authenticated domain name of the verifier.

The W3C's Web Authentication Level 3, a W3C Recommendation dated 25 August 2026, defines public key credentials each scoped to a given relying party.

Its section 13.4.9 says the relying party MUST validate the origin in the client data and MUST NOT accept unexpected values. It adds that this origin check is an additional layer of protection in case a faulty authenticator fails to enforce credential scope.

In the specification's terminology, passkey is another name for a discoverable credential, and its use cases describe phishing-resistant sign-in with multi-device credentials, commonly referred to as synced passkeys. CISA's October 2022 fact sheet called FIDO/WebAuthn the only widely available phishing-resistant authentication.

A passkey or security key counts as two factors only when the person was verified on the device. The OWASP cheat sheet says that when passkeys are used as MFA, the application should require user verification and validate the returned user-verification flag on the server, and that a touch confirming user presence alone is not a second factor.

NIST section 3.1.7.2 says that if a multi-factor cryptographic authenticator's flag shows an activation factor was not used, the authentication SHALL be treated as single-factor.

The standards differ in how hard they push. NIST section 2.2.2 says verifiers SHALL offer at least one phishing-resistant authentication option at AAL2 and SHOULD encourage its use whenever practical. ASVS 5.0 requirement 6.3.3, at Level 2, asks that a multi-factor mechanism or a combination of single-factor mechanisms is used to access the application, and at Level 3 that one of the factors is a hardware-based mechanism which provides compromise and impersonation resistance against phishing while verifying the intent to authenticate through a user-initiated action.

Its last sentence says relaxing any of the considerations in the requirement requires a fully documented rationale and a comprehensive set of mitigating controls.

The OWASP cheat sheet and CISA both say any MFA is better than no MFA. A one-time code still stops a password from being enough on its own. It does not stop a fake sign-in page that passes the code on.

MFA bypass techniques a defender should recognise

A strong factor can still be skipped.

The first four weaknesses below belong to the application rather than to the factor, and the last belongs to the factor itself. Each maps to rows in the test matrix, and the lab shows several of them in a careless and a careful version.

A second step the server does not wait for

Where a sign-in with an authenticator app is two requests, the password and then the code, the flaw sits between them. 1 min read

Older routes that still take a password alone

The OWASP cheat sheet describes MFA downgrade attacks, which try to force authentication through legacy protocols or flows that do not enforce the same MFA requirements. 1 min read

Codes that can be replayed or guessed

A one-time password is only one-time if the server remembers it was used. 2 min read

A factor check that fails open

MITRE ATT&CK technique T1556.006 describes adversaries disabling or modifying MFA to keep access to compromised accounts, and notes that if a fail open policy is in place, an otherwise successful authentication may be granted access without enforcing MFA when the MFA process fails. 1 min read

Text messages, voice calls and email

NIST treats codes sent over the telephone network as a restricted authenticator. 1 min read

MFA fatigue: push notification MFA and what number matching changes

Push notification MFA sends a prompt to an app on the user's phone and signs them in when they approve it.

CISA's fact sheet on number matching, dated October 2022, describes MFA fatigue, also known as push bombing, as a cyber threat actor bombarding a user with push notifications until the user approves the request by accident or out of annoyance.

Someone who already has the password can, in CISA's words, generate hundreds of prompts on the user's device over a short period of time, and the prompts may also confuse a user into assuming one of them is legitimate.

MITRE ATT&CK lists the technique as T1621, Multi-Factor Authentication Request Generation, and adds that adversaries who lack credentials may abuse automatic push generation where it is configured for self-service password reset.

NIST has moved away from plain approval. Section 3.1.3 says a method that compares the secrets received from the primary and secondary channels and requests approval on the secondary channel is no longer considered acceptable, because it increases the likelihood that the subscriber approves without actually comparing them, as observed with authentication fatigue attacks.

In a push flow, the secondary channel is the one that reaches the app on the user's phone. The guideline requires the secret to be transferred between the device and the sign-in session instead, and says presenting a list of secrets to compare is not sufficient, because the claimant may reasonably guess from a list that short.

Section 3.1.3.2 says verifiers that send push notifications SHOULD implement a reasonable limit on the rate or total number sent since the last successful authentication.

Number matching is the setting that makes that transfer. CISA describes it as forcing the user to enter numbers from the identity platform into their app to approve the request, and says it mitigates fatigue in two ways: approval requires access to the sign-in screen, and each prompt carries a unique set of numbers, so generating many prompts stops being effective.

CISA recommends number matching for organisations using push MFA that cannot yet implement phishing-resistant MFA, and says it is not as strong; its other fact sheet lists push with number matching as resistant to push bombing and vulnerable to phishing.

NIST does not count out-of-band authentication as phishing-resistant either. A fake page that relays the real sign-in can show the user the real number, so number matching answers fatigue rather than relay.

What a push flow on your own application should do, with the source behind each point:

  • Cap the prompts. Beside NIST's SHOULD above, ASVS 5.0 requirement 6.6.4, at Level 3, asks for rate limiting to prevent push bombing and says number matching may also mitigate the risk; the OWASP cheat sheet says to rate-limit or cap push notifications; and one of MITRE's mitigations for T1621 (M1032) says, among other things, to implement limits on the maximum number of MFA request prompts that can be sent to users in a period of time.
  • Require the number. The user types the number shown on the sign-in screen into the app; a bare Approve button, or a choice from a short list, does not finish the sign-in. NIST section 3.1.3.1 says an out-of-band authenticator that requests approval SHALL accept a transfer of the secret from the primary channel, and the note in section 3.1.3 says presenting a list of secrets to compare is not sufficient.
  • Show what is being approved. MITRE's user training mitigation for T1621 (M1017) says, among other things, to train users to review the source location of the login attempt prompting the request. Users can do that from the prompt only if it shows where the attempt came from, so showing the application's name, the place and the time is this page's advice.
  • Expire and use once. NIST section 3.1.3.2 says an out-of-band authentication SHALL be considered invalid unless completed within 10 minutes, and its secret accepted only once; ASVS requirement 6.5.5, at Level 2, gives out-of-band requests a maximum lifetime of 10 minutes.
  • Follow up denials. CISA recommends investigating denied push requests, because MFA checks happen after the first factor, so a denial could mean the password is compromised, and training users to report unknown or bulk confirmation requests.

Enrolment and factor changes: when a factor is bound to the account

NIST calls the moment a factor is attached to an account binding.

Section 4, Authenticator Event Management, includes binding among the events that can occur over the lifetime of an authenticator and affect its use, and section 4.6 gives it as an example of an account event that requires the subscriber, or someone they designate, to be independently notified. Section 4.1.2.1 says that when any new authenticator is bound, the process SHALL require authentication at the maximum assurance level currently available in the account, or the maximum assurance level at which the new authenticator will be used, whichever is lower, and that the provider SHALL notify the subscriber through a mechanism independent of the transaction that bound it.

Section 4.1 says the provider SHALL keep a record of every authenticator bound to each account, with the date and time of significant lifecycle events, and SHOULD record the source of the binding, such as an IP address or device identifier.

Enrolment is a bypass in its own right when it asks for too little. MITRE ATT&CK technique T1098.005 says an adversary that compromises a user's credentials may enrol a new device to bypass initial MFA requirements and gain persistent access, and that in some cases self-enrolment may require only a username and password to enrol an account's first device or a device for an inactive account.

Its mitigation (M1032) includes configuring MFA systems to disallow enrolling new devices for inactive accounts. T1556.006 lists registering a new adversary-controlled MFA method among the ways an attacker who is already in keeps access.

The careless lab version let a signed-in session start enrolment without the password and switched the new factor on before any code from the app had confirmed it, so a user who stopped halfway met a code prompt at the next sign-in for an app they never finished setting up.

The careful version asks for the password first and keeps the new secret pending until a code proves the app holds it. Asking for the password again on an account that only has a password is this page's advice: NIST's rule asks for authentication at the lower of the account's current maximum level and the maximum level the new factor will be used at, which a session signed in with the password may already meet.

Changing a factor is where a stolen session can become a stolen account. The OWASP cheat sheet says factor changes, such as a new phone number, a new authenticator app or a replaced hardware token, must be strictly secured because attackers can exploit the process to take over accounts.

Its best practices include: require reauthentication with an existing enrolled factor before allowing changes; do not rely solely on the active session, as it may be hijacked; treat factor replacement as a high-risk action and apply risk-based checks, such as a new device or unusual location; notify the user through out-of-band channels, such as email or push notification, whenever a factor changes; and consider delays or step-up verification for high-value accounts.

ASVS 5.0 requirement 7.5.1, at Level 2, asks for full reauthentication before changes to the MFA configuration, and NIST counts a new phone number for text-message codes as binding a new authenticator. The careless lab version removed the factor on the session alone and told nobody.

Once a factor changes, the sessions it protected should not carry on unchallenged. ASVS 5.0 requirement 7.4.3, at Level 2, asks that users are given the option to end all other active sessions after a change or removal of any authentication factor, including an MFA settings update; the session management guide covers how sessions end. The careful lab version ends the other sessions and forgets remembered devices when the factor is removed.

MFA recovery security: why the lost-factor path is the weak point

Recovery exists to let someone in without the factor, which makes it the path to examine first.

NIST's informative threats section puts the risk plainly in section 6.3: the weak point in many authentication mechanisms is the process followed when a subscriber loses control of authenticators and needs to replace them; in many cases the options for authenticating the subscriber are limited, and economic concerns, such as the cost of maintaining call centres, motivate inexpensive and often less secure backup methods; and where recovery is human-assisted, social engineering attacks also pose risks.

The OWASP cheat sheet calls handling users who lose their factors one of the biggest challenges of implementing MFA: there needs to be a way back in, and it is crucial that the way back does not give an attacker a means to bypass MFA and hijack the account.

The cheat sheet says there is no definitive best way, and that what is appropriate varies with the security of the application and the control over its users. Its suggestions of possible methods include single-use recovery codes issued when MFA is first set up; requiring users to set up several types of MFA, so they are unlikely to lose all of them at once; mailing a one-use recovery code or a new hardware token to the registered address; requiring the user to contact a support team with a rigorous process to verify their identity; and requiring another trusted user to vouch for them.

Whichever method you choose, recovery should ask for no less than sign-in. The cheat sheet says so in its section on security questions: account recovery is an alternate way to authenticate, so it should be no weaker than regular authentication. NIST makes it concrete.

Section 4.2.2.2 says that to recover an account that can authenticate at a maximum of AAL2, the provider SHALL require one of three things: two recovery codes obtained by different methods, one recovery code plus authentication with a single-factor authenticator bound to the account, or repeated identity proofing where the account was proofed.

Section 6.3 adds that one factor must not be usable to obtain an authenticator of a different factor, giving the example that a password must not be usable to obtain a new list of look-up secrets.

ASVS 5.0 requirement 6.4.4, at Level 2, asks that when an MFA factor is lost, identity proofing is performed at the same level as during enrolment, and requirement 6.4.2, at Level 1, rules out secret questions.

Applied to an application where users sign in with a password and an authenticator app, the second of NIST's options means the password plus a recovery code. An emailed link on its own is one issued recovery code and no more. NIST allows issued recovery codes to be sent to an email address, valid for at most 24 hours, and section 3.1.3.1 says codes issued as recovery codes are not authentication processes and are not affected by its ban on email for out-of-band authentication; but one issued code alone is not among the three options at AAL2.

Saved recovery codes have rules of their own. NIST section 4.2.1.1 says a saved recovery code SHALL include at least 64 bits from an approved random bit generator and SHALL be stored in hashed form using an approved one-way function, as described in section 3.1.1.2; its verification SHALL be subject to the throttling requirements; and once used, the provider SHALL invalidate it and SHALL issue a new saved code.

It also says the subscriber MAY request a replacement recovery code at any point following enrolment, and that the issuance of a replacement recovery code SHALL result in an account recovery notification.

ASVS 5.0 requirement 6.5.2, at Level 2, asks that look-up secrets with less than 112 bits of entropy are hashed with an approved password hashing algorithm and a 32-bit random salt, and allows a standard hash function at 112 bits or more. The lab's codes are 128 random bits each, stored as SHA-256 hashes and removed when used.

NIST's text describes a saved code replaced after each use, while the lab issues a set of ten and tells the user how many remain. The careless version kept its codes as written and accepted the same one twice.

A support desk that can remove a factor is a recovery path too. NIST section 4.2.1 says a provider MAY support an application-specific method, such as interaction with one of its agents, but that alternative methods SHALL be based on a risk analysis and documented, and its threat table lists an insider, such as a customer support representative, colluding with an attacker to give access to accounts.

Write down what support may accept as proof, hold it to the level ASVS requirement 6.4.4 asks for, tell the account owner every time it is used, and test it with the support team, who know it is a test, on a test account.

Recovery should also clear away what the lost factor left behind. NIST section 4.2.3 says that in all cases account recovery SHALL cause a notification to be sent to the subscriber or their designee. The OWASP Forgot Password Cheat Sheet makes the point for password resets: a reset alone may not restore control, because an attacker may still have an active session or may have changed recovery information or MFA methods, and after recovering a potentially compromised account, existing sessions and outstanding recovery links or codes should be invalidated. Remembered devices need the same treatment, which the next section covers.

Remembered devices: what skipping the second step should cost

A remember this device option trades the second factor for a cookie, and the sources weigh that trade differently.

NIST SP 800-63B-4, written for government systems, says in section 5.1 that cookies and similar remember my browser features SHALL NOT be used instead of authentication, with one exception: reauthentication at AAL2 when the inactivity timeout has passed but the overall timeout has not.

The OWASP Multifactor Authentication Cheat Sheet takes a risk-based view: having to sign in with MFA frequently burdens users and may cause them to disable it, and risk-based authentication can reduce how often MFA is asked for, for example by requiring it when a user signs in from a new device or location. The OWASP Authentication Cheat Sheet says remembered-device cookies should be risk signals rather than substitutes for authentication.

If you offer it, the device token stands in for the second factor, so it needs the protections a factor has. In the careful lab version the token is a random value, stored on the server only as a hash, tied to one account and to that account's current factor, with an expiry the server checks.

When the factor is removed or reset, every remembered device is forgotten. In the careless version the token was stored as written and checked only against the account, so a browser remembered before Sam reset the authenticator through a recovery code still skipped the code afterwards.

None of these details comes from a standard; they are this page's advice for keeping the cookie no easier to misuse than the factor it replaces.

Two more rules follow. A remembered device should not count as fresh proof for a sensitive action, and the account owner should be able to see the list and remove a device, with the removal taking effect on the server. The session management guide covers the account page that lists sessions and devices.

Asking for the factor again before a sensitive action

Passing the second factor at sign-in does not mean every later action was approved by the person holding it.

The OWASP cheat sheet says the most important place to require MFA is sign-in, and that depending on the functionality it may also be appropriate to require it for sensitive actions such as changing passwords or security questions, changing the email address, disabling MFA, and elevating a session to an administrative one.

ASVS 5.0 requirement 7.5.3, at Level 3, asks for further authentication with at least one factor, or secondary verification, before highly sensitive transactions or operations. Reauthentication before password and email changes is covered in the authentication failures guide.

What counts as asking again is a design decision worth writing down. The careful lab version wants a code that has not been used before, sent with the request that changes payout details; the session alone, however recently it signed in, is not enough. The careless version changed the details on the session.

Where sign-in happens at an identity provider, ASVS requirement 6.8.4, at Level 2, asks the application to verify the authentication strength, methods or recentness it expects using the information the provider returns, gives validating the acr, amr and auth_time claims of an OpenID Connect ID token as one way this might be done, and asks for a documented fallback that assumes the minimum strength mechanism when the provider does not supply them. The OAuth and OIDC security guide covers the protocol.

Who should be told when a factor changes

The account owner first, and somewhere the person making the change cannot intercept.

NIST section 4.6 says certain account events, such as binding an authenticator and account recovery, require the subscriber or someone they designate to be independently notified, to help detect fraud. Notifications SHALL go to the notification addresses stored in the account, the provider SHALL support at least two such addresses, and each notification SHALL give clear instructions, including contact information, in case the recipient did not make the change.

Section 4.5 says the provider SHOULD notify the subscriber when an authenticator is invalidated.

The OWASP cheat sheet asks for a notice through out-of-band channels, such as email or push notification, whenever a factor changes, and ASVS 5.0 requirement 6.3.7, at Level 3, asks that users are notified after updates to authentication details.

A failed or denied second factor deserves a notice too. The OWASP cheat sheet and CISA both point out that it could mean the password is known to someone else; the credential stuffing guide covers that notice. ASVS 5.0 requirement 6.3.5, at Level 3, asks that users are notified of suspicious authentication attempts, and gives partially successful authentication, where only one of several factors succeeded, as an example.

Inside the business, someone should see the patterns no single user notices: a burst of prompts to one account, repeated wrong codes, a factor changed soon after a sign-in from somewhere new. That is a job for logging and alerting.

What to log for the second factor

ASVS 5.0 requirement 16.3.1, at Level 2, asks that all authentication operations are logged, successful and unsuccessful, and says the type of authentication or the factors used should be collected as well.

For a second factor that covers:

  • Every code check, with its outcome and the reason for a refusal, such as wrong, already used or locked.
  • Every push prompt sent, and whether it was approved, denied or left to expire.
  • Each binding, change and removal of a factor, with the date and time and the IP address or device. Logging all three with those details is this page's advice. NIST section 4.1 says the provider's record SHALL contain the date and time of significant authenticator lifecycle events, giving binding, renewal, update and expiry as examples, and SHOULD include information about the source of the binding, such as an IP address or device identifier.
  • Recovery codes used and refused, and every support-desk reset.
  • Remembered devices issued, used and forgotten, and sensitive actions refused for want of a fresh code.

Keeping codes out of the log

The OWASP cheat sheet says one-time password implementations SHOULD NOT log code values, and ASVS requirement 16.2.5, at Level 2, asks that logging of sensitive data follows the data's protection level, giving as an example that it may not be allowed to log certain data, such as credentials or payment details.

The careless lab version wrote the wrong code into its log line; the careful version records the event, the account and the time. MITRE's detection guidance for T1621 suggests monitoring for excessive or anomalous push notifications or token requests, and the OWASP cheat sheet suggests watching for several push prompts in a short period and sudden MFA method changes.

Where these events are kept and who is alerted is the subject of the security logging and monitoring guide.

MFA testing on an application you own

The test matrix in the asset on this page is organised by state change: from no factor to enrolled, from password to second factor, from one factor to another, from a lost factor to a recovered account, from a remembered device to a skipped step, from a push prompt to approval, and from signed in to a sensitive action.

Each row gives the steps, the expected result, the evidence to keep and the source behind the expectation, or says the expectation is the matrix's own advice.

Run it only against an application you own or are authorised in writing to test, with test accounts created for the purpose, on a staging copy where you have one. Some rows can do harm even there. Lockout and recovery rows run only on test accounts.

Push rows send prompts only to a test device you hold, and text-message rows only to a test number, never to a real person's phone. The support-desk row is a walk-through with the support team, who know it is a test, on a test account.

Decide first which ASVS level you are working to, because several rows are Level 2 or Level 3 requirements. Some rows go faster with the code open: how the code check records the last used step, how recovery codes are stored, what the remembered-device cookie points to, and which routes issue a session.

Running the MFA lab on your own machine

The lab in the asset is an illustration with one kind of factor: a time-based one-time password built from RFC 6238 with node:crypto.

Push prompts, text messages and passkeys are covered by the matrix and the sources above, not by the lab. It is a small sign-in service with two invented accounts in a careless version and a careful version, plus a check of the code generator against the RFC test values, a runner that walks a baseline sign-in and the fourteen matrix rows the lab can show, and a regression test.

The server binds to 127.0.0.1 and asks for port 0, which the Node.js net documentation says makes the operating system assign an arbitrary unused port; it keeps everything in memory and puts notices in an in-memory outbox. The lab imports only node:http, node:crypto, node:test and node:assert, and installs no packages.

The lab's secrets are invented or made fresh. The two accounts are made up, and their passwords end in not-real. Authenticator secrets, recovery codes and device tokens are random values the lab creates in memory on each run and never prints, and the only fixed key is the RFC test key.

The lab reads time from a clock fixed at Unix time 1767225600 (1 January 2026, 00:00:00 UTC) at the start of every check and moved on only by the checks, so every run walks through the same time steps and prints the same results.

It was written and run on Node.js 26.0.0 on an Apple M3 Max machine running macOS, and every output in the asset was copied from that run by a script. Before anything else, check-rfc-vectors.mjs computes the ten 6-digit HOTP values in RFC 4226 Appendix D and the six SHA-1 TOTP values in RFC 6238 Appendix B, and all 16 matched.

  • Save the seven files from the asset into an empty folder and open a terminal there.
  • Run node check-rfc-vectors.mjs to check the code generator against the published values.
  • Run node run-matrix.mjs. The careless version held 1 of the 15 checks, the baseline sign-in, and the careful version held all 15.
  • Run node mfa-checks.test.mjs, where all 15 tests pass, then node mfa-checks.test.mjs careless, where 14 fail. Node's test runner sets the exit code to 1 when any test fails. A pipeline step that treats a non-zero exit code as a failure then fails.

Where an outside test fits

Your own matrix run covers the routes and flows you know about.

A Clever Ops web application and API penetration test covers authentication and sessions, including whether reset skips multi-factor sign-in where it is on, and lockout, password reset and multi-factor checks run on test accounts. Each finding comes with redacted requests and responses, the accounts that sent them, the steps to reproduce it, a fix and the criteria the retest will use.

If Clever Ops built or hosts your application, the work is a security review rather than an independent test, and the report says who built it and who hosts it.

Frequently asked questions

Getting into an account that has a second factor without that factor being checked when it matters. Either the factor is beaten at sign-in, for example a code typed into a fake page that relays it or a push prompt approved to make the prompts stop, or it is gone around through enrolment, recovery, a remembered device, an older sign-in route or a second step the server does not enforce. The OWASP Multifactor Authentication Cheat Sheet says attackers increasingly target weaknesses in MFA deployments and authentication workflows rather than attempting to defeat MFA itself.

It depends on the factor. NIST SP 800-63B-4 says out-of-band and one-time password authenticators, whose output the user types in, SHALL NOT be considered phishing-resistant, because typing the output in does not bind it to the session being authenticated; its example is an impostor verifier relaying the output to the real one and successfully authenticating. Phishing resistance needs cryptographic authentication bound to the session or to the site's name, and NIST gives WebAuthn as an example. CISA's October 2022 fact sheet called FIDO/WebAuthn the only widely available phishing-resistant authentication.

MFA fatigue, or push bombing, is sending push prompts to someone whose password is known until they approve one, by accident or out of annoyance, as CISA describes it. Number matching makes the user type a number from the sign-in screen into the app, so a prompt cannot be approved without seeing that screen. CISA says it mitigates fatigue but is not as strong as phishing-resistant MFA. Limiting how many prompts are sent, which NIST says verifiers SHOULD do, belongs beside it.

NIST SP 800-63B-4 treats codes sent by text or voice as a restricted authenticator: the provider SHALL, among other things, offer an unrestricted alternative and give meaningful notice of the risks, and a change of phone number counts as binding a new authenticator. ASVS 5.0 requirement 6.6.1, at Level 2, allows them only when the phone number has previously been validated, stronger methods are also offered and the service gives users information on their security risks, and says they must not be available at Level 3. CISA lists SMS and voice as vulnerable to phishing, SS7 and SIM swap attacks and calls them a last resort.

NIST SP 800-63B-4 section 4.2.1.1 says a saved recovery code SHALL include at least 64 bits from an approved random bit generator, SHALL be stored in hashed form and SHALL be subject to the throttling requirements of section 3.2.2, and that after a code is used the CSP SHALL invalidate it and SHALL issue a new saved recovery code. Recovery as a whole should ask for no less than sign-in. Section 4.2.2.2 says that to recover an account that can authenticate at a maximum of AAL2, the CSP SHALL require one of: two recovery codes obtained by different methods, one recovery code plus authentication with a single-factor authenticator bound to the account, or repeated identity proofing where the account has been identity-proofed. Section 4.2.3 says account recovery SHALL cause a notification to the subscriber or their designee.

NIST SP 800-63B-4, written for government systems, says remember-my-browser features SHALL NOT be used instead of authentication, outside one reauthentication case at AAL2. The OWASP cheat sheets take a risk-based view, with remembered-device cookies used as risk signals rather than substitutes for authentication. If you offer it, store the token only as a hash, expire it on the server, and forget every remembered device when the factor is reset or removed.

Use test accounts on a staging copy, send push prompts and text messages only to devices and numbers you hold, and walk through each state change: enrolment, sign-in with the code, changing or removing the factor, recovery, remembered devices, push approval and sensitive actions. The matrix on this page lists the steps, the expected result, the evidence to keep and the source for each row. The lab runs fourteen of those rows plus a baseline sign-in against a careless version, where the fourteen fail, and a careful version, where all fifteen checks hold.

Scope the right test for your application

Tell us what you have built, who uses it and when it needs to launch. You will get a plain-English recommendation: a website audit, a web application test or a referral to a specialist.