MFA Replay Attack

Published
Length
3 min read

Luis Felipe Dias

All posts

An mfa replay attack happens when an attacker steals a valid login code or token. The attacker then sends that captured token again to open a new session. Engineering teams often set up multi-factor checks to guard cloud apps and databases. They trust that a second factor blocks all bad logins. Still, if the underlying role has broad rights, one stolen token causes huge damage. Attackers reuse that single login pass to read sensitive data or run bad commands. How an mfa replay attack works in

Attack Surface Management + Session Replay & Forensics: the complete guide

Architecture patterns, implementation strategies, and security best practices. Delivered to your inbox.

Free white paper. No spam. Unsubscribe anytime.

An mfa replay attack happens when an attacker steals a valid login code or token. The attacker then sends that captured token again to open a new session. Engineering teams often set up multi-factor checks to guard cloud apps and databases. They trust that a second factor blocks all bad logins. Still, if the underlying role has broad rights, one stolen token causes huge damage. Attackers reuse that single login pass to read sensitive data or run bad commands.

How an mfa replay attack works in practice

A standard login flow asks a user for a password and a second code. The user enters both items to prove who they are. The login server checks the code and creates a session token. In a replay attack, a bad actor sits between the user and the server. They grab the one-time code or the session cookie while it moves across the network.

Some systems do not mark a one-time code as used right away. They allow a short time window where the same code still works. The attacker sends the stolen code inside that window to log in as the user. In other cases, the attacker steals the post-login token from the client machine. They replay that token from their own device to skip the login prompt.

Hardware keys that bind to a specific web address help stop fake login pages. Time-based codes and push prompts do not bind to the network session at all. If an attacker tricks a user with a fake site, they capture the token fast. Once inside, the attacker holds the exact same role as the real engineer.

Why login checks leave active sessions exposed

Setting up strong login rules solves only the first part of the security problem. Phishing-resistant keys and single-use checks make it hard to reuse a raw code. Server rules that block repeat codes within the same minute also help a lot. These controls check who can log in at the very start of a session.

Still, login checks stop working the moment the session starts. They do not watch what individual SQL queries or shell commands do in flight. If an attacker steals an active session token from memory, login rules do nothing. The database or server sees a valid user role and runs every request.

Attack Surface Management + Session Replay & Forensics: architecture patterns and best practices

Continue reading? Get the full guide.

Free. No spam. Unsubscribe anytime.

Most teams give engineers broad roles so they can fix production issues fast. One shared admin role might allow reading all tables and dropping records. When a replayed token uses that role, the attacker gets full control right away. The native login flow cannot block a destructive command or mask private fields like emails. It also cannot ask a manager to approve one risky query inside an open session.

Steps to limit risk across production systems

Teams should first switch from text codes and basic push alerts to hardware keys. Hardware keys check the real domain name before they send any cryptographic proof. This step stops attackers from capturing and replaying codes through fake login pages. Next, admins must make session lifetimes much shorter for all production tools.

Short sessions shrink the time window an attacker has to reuse a stolen token. Server teams must also enforce strict single-use rules for every one-time code. Once a code works once, the server must reject it for all future attempts. Finally, teams need controls that inspect actual commands and mask card numbers or phone numbers.

Check database and API queries on the wire

Identity tools, roles, and network rules decide who opens a session. Setup alone cannot check what each query does or mask sensitive values in a response once a session starts. When workflows touch Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, or internal HTTP APIs, hoop.dev runs beside those services as an open-source proxy, a sidecar for your Postgres or API. It inspects requests coming in and results going back on the wire.

Your login details and client tools stay as they are while hoop.dev guardrails refuse bad deletes or drops before they run. On responses, hoop.dev data masking rewrites matched sensitive values in memory. Furthermore, hoop.dev holds SOC 2 Type II, is MIT licensed, and writes every query and decision to an audit trail that generates evidence for HIPAA, GDPR, and PCI DSS. See the source on GitHub.

Frequently asked questions

What is the difference between a replay attack and push fatigue?

A replay attack reuses a captured code or token to open a session. Push fatigue spams a user with login prompts until they tap approve by mistake.

Do time-based one-time codes stop replay attacks?

No, they only stop attacks if the server blocks a code after one use. Otherwise, an attacker can reuse the code before the thirty-second timer runs out.

Can attackers replay a session after the multi-factor check finishes?

Yes, attackers often steal the session cookie stored on the user device after login. They send that cookie from their own machine to bypass the login screen.

Save the open-source gateway.

hoop is MIT-licensed infrastructure for controlling how AI agents reach production data. Star hoophq/hoop so you can inspect it, deploy it, or share it when your team starts governing agent access.