Suspicious activity triggers additional step-up
Why it matters
Impossible travel, rapid transaction sequences, and unusually large transfer amounts are established signals of account compromise or fraud. Without anomaly detection, an attacker who obtains a valid session token — through phishing, session fixation, or XSS — can execute transactions that would immediately appear suspicious to any human reviewer but proceed unchallenged by the application. CWE-307 (Improper Restriction of Excessive Authentication Attempts) and NIST SI-4 (System Monitoring) address active threat detection requirements. PCI-DSS Req 10.7 requires that anomalies trigger alerts. Suspicious activity step-up provides a dynamic second factor that activates precisely when risk is highest, without adding friction to normal user behavior.
Severity rationale
Low because suspicious activity detection is a defense-in-depth layer — its absence does not enable initial access, but it removes the runtime signal that would detect and interrupt an active attack on an already-compromised session.
Remediation
Add at least two anomaly detection rules in src/lib/fraudDetection.ts — impossible travel is the highest-signal, lowest-false-positive starting point:
export async function checkSuspiciousActivity(
userId: string,
currentLocation: { lat: number; lng: number }
): Promise<boolean> {
const lastSession = await db.sessions.findFirst({
where: { userId },
orderBy: { loginAt: 'desc' },
skip: 1 // skip current
});
if (!lastSession?.location) return false;
const elapsedMin =
(Date.now() - lastSession.loginAt.getTime()) / 60000;
const distanceKm = geoDistance(lastSession.location, currentLocation);
const speedKmMin = distanceKm / elapsedMin;
return speedKmMin > 15; // >15 km/min is physically impossible
}
When checkSuspiciousActivity returns true, call requireStepUp() before allowing any financial operation to proceed. Add a second rule (e.g., transactions above a threshold amount) to meet the two-rule minimum.
DetectionPro
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 Session Security Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-307 — Improper Restriction of Excessive Authentication Attempts
- owasp:2021 · A07
- nist:rev5 · SI-4 — System Monitoring
- pci-dss:4.0 · Req 10.7 — Failures of critical security controls detected and reported
Taxons
History
- 2026-04-18·v1.0.0·Initial import from finserv-session-security·automated