# Multi-factor authentication available

- **Pattern:** `ab-002403` (`security-hardening.input-validation.mfa-available`)
- **Severity:** medium
- **Lifecycle:** active
- **Last modified:** 2026-07-06
- **Canonical URL:** https://auditbuffet.com/patterns/ab-002403
- **License:** CC-BY-4.0 — attribute to AuditBuffet Pattern Catalog (https://auditbuffet.com/patterns/ab-002403)

## Why it matters

Without MFA, a stolen or phished password is sufficient to compromise any account. CWE-308 (Use of Single-Factor Authentication) and OWASP A07 (Identification & Authentication Failures) both flag password-only auth as a systemic weakness. NIST 800-53 IA-2(1) mandates multi-factor authentication for privileged accounts and for any system handling sensitive data. Credential phishing is the most common initial access vector in reported breaches; MFA stops the majority of these attacks even after credentials are compromised. Admin accounts without MFA are an especially high-value target because a single compromise grants full application access.

## Severity rationale

Medium because MFA absence doesn't directly expose a vulnerability, but it means a stolen password alone — the most commonly leaked credential type — provides full account access.

## Remediation

Implement TOTP-based MFA using `otplib`. Store the secret encrypted; only mark `totpEnabled: true` after the user successfully verifies their first code:

```ts
import { authenticator } from 'otplib'

// Enrollment: generate and return QR code
const secret = authenticator.generateSecret()
const otpauth = authenticator.keyuri(user.email, 'YourApp', secret)
// Save encrypt(secret) to database with totpEnabled: false

// Verification: check code before enabling
const isValid = authenticator.check(userCode, secret)
if (isValid) await db.user.update({ where: { id }, data: { totpEnabled: true } })
```

Force MFA enrollment for admin roles on first login. Provide backup codes at enrollment time and store them hashed.

## Detection

**The detection method for this pattern is part of AuditBuffet Pro.**

The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the [Security Hardening Audit](https://auditbuffet.com/audits/security-hardening). The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.

## External references

- cwe CWE-308
- owasp A07
- nist IA-2(1)
- soc2 CC6.1

Taxons: access-control

HTML version: https://auditbuffet.com/patterns/ab-002403
