Security

What is 2FA?

Also known as: Two-Factor Authentication

Definition

Two-factor authentication (2FA) is a security method that requires a user to present two distinct types of evidence to verify their identity, typically a password and a time-based one-time code from an authenticator app or hardware key.

Two-factor authentication (2FA) is a security mechanism that adds a second layer of verification beyond a password. It belongs to the broader category of multi-factor authentication (MFA). The core idea is to combine two different factors from three categories: something you know (a password), something you have (a phone or hardware token), or something you are (a fingerprint or other biometric). By requiring two distinct factors, 2FA dramatically reduces the risk of account takeover from stolen or guessed passwords.

The most common implementation uses a time-based one-time password (TOTP), defined in RFC 6238. A shared secret is stored on the user's device (e.g., in an authenticator app like Google Authenticator or Authy) and on the server. Every 30 seconds, the app generates a six-digit code based on the current time and the secret. The user enters this code after their password. Another popular form uses hardware security keys, such as those compliant with FIDO U2F or WebAuthn standards. These keys perform a cryptographic challenge-response and are resistant to phishing because the key verifies the domain before signing. SMS-based codes are also widely used but are considered less secure due to risks like SIM swapping.

In the wider security stack, 2FA is a critical control for protecting user accounts, especially for email, financial services, and corporate systems. It is often mandated by compliance frameworks (e.g., PCI DSS, NIST SP 800-63B). While not foolproof, 2FA raises the bar for attackers significantly. Modern implementations increasingly favor phishing-resistant methods like WebAuthn over SMS or TOTP. 2FA is also a foundational element of zero-trust architectures, where every access request is treated as potentially hostile and must be verified with multiple factors.

Key facts

  • 2FA requires two different authentication factors, typically knowledge and possession.
  • Time-based one-time passwords (TOTP) are defined in RFC 6238 and expire every 30 seconds.
  • Hardware security keys (e.g., YubiKey) provide phishing-resistant 2FA using FIDO2/WebAuthn.
  • SMS-based 2FA is vulnerable to SIM swapping and is discouraged by NIST guidelines.
  • 2FA is a subset of multi-factor authentication (MFA), which may use two or more factors.

How it works in practice

When logging into a web service that supports 2FA, a user first enters their username and password. The server then prompts for a second factor. The user opens an authenticator app on their phone, which displays a six-digit code that changes every 30 seconds. They type that code into the login page. If the code matches the server's calculation, access is granted. Alternatively, the user might tap a USB security key against a reader, which performs a cryptographic handshake without requiring a manually entered code.

Related terms

Multi-Factor Authentication (MFA) Time-based One-Time Password (TOTP) FIDO2 WebAuthn Security Key One-Time Password (OTP) Authenticator App

References

More in Security

Bot Management

Bot management detects automated web traffic and distinguishes it from human users, using behavioral fingerprinting and other signals to block malicious bots while allowing benign ones.

Credential Stuffing

Credential stuffing is a cyberattack in which automated tools use username-password pairs leaked from one site to try logging into other sites, exploiting password reuse.

DDoS

A DDoS (Distributed Denial of Service) attack overwhelms a target server, service, or network with massive traffic from many compromised computers, making it unavailable to legitimate users.

DDoS Scrubbing

DDoS scrubbing diverts attack traffic to a specialized filtering facility that removes malicious packets and forwards only legitimate traffic to the target network.

Firewall

A network security device or software that monitors and controls incoming and outgoing traffic based on predetermined security rules, acting as a barrier between trusted and untrusted networks.

IDS

An Intrusion Detection System (IDS) monitors network traffic or host activity for signs of malicious behavior or policy violations and generates alerts for security personnel.

IPS

An Intrusion Prevention System (IPS) is a network security device that monitors traffic inline and actively blocks malicious packets before they reach their target.

OAuth 2.0

OAuth 2.0 is an authorization framework that allows a user to grant a third-party application limited access to their resources on another service without revealing their password.

OpenID Connect

OpenID Connect (OIDC) is an identity authentication layer built on OAuth 2.0 that provides a signed ID token containing verified user identity claims.

Passkey

A passkey is a FIDO2/WebAuthn credential stored on a user's device that replaces passwords with public-key cryptography for authentication.

Who Is Online

In total there are 67 users online: 0 registered, 59 guests and 8 bots.

Most users ever online was 5,555 on 17 Jul 2026, 3:23 am.

Bots: AhrefsBot Applebot Baiduspider Bingbot Other Bot Other Crawler PetalBot SemrushBot

Users active in the past 15 minutes. Total registered members: 369