Security & Fraud Prevention

Enterprise and Military Grade Identity Verification Platform

Military-grade security with 3-strike fraud prevention, inline duplicate detection, and comprehensive audit logging

3-Strike Fraud Prevention System

Coverage: ALL user types protected — External Users (4 factors), Tenant Admins (3 factors), System Admins (3 factors)
Attempt 1 & 2

Response: "Already registered. Want to log in instead?"

  • User-friendly message
  • Offer login option
  • No blocking yet
  • Attempt count tracked
{
  "passed": false,
  "reason": "This face is already registered...",
  "offerLogin": true,
  "attemptCount": 1
}
Attempt 3 — BLOCK!

Response: Account blocked due to repeated fraud attempts

  • Immediate block
  • IP address logged
  • SECURITY page alert
  • Audit trail created
{
  "passed": false,
  "reason": "Account blocked...",
  "blocked": true,
  "attemptCount": 3
}
Protected Factors

External Users (4):

  • Email verification
  • Mobile OTP
  • Face liveness
  • Document ID

Internal Users (3):

  • Face liveness
  • Document ID
  • Mobile OTP
How It Works
Session Tracking
  • Storage: gg-widget-sessions table
  • Key: {sessionId}:{hashValue}
  • TTL: 1 hour (auto-cleanup)
  • Scope: Per session (prevents false positives)
Audit Logging (3rd Attempt)
  • Action: FRAUD_ATTEMPT_BLOCKED
  • Severity: HIGH
  • Data: IP address, duplicate type, timestamp
  • Display: SECURITY page alert

Inline Fraud Prevention

Key Innovation: Blocks duplicates DURING verification (not after). Fraudsters never get verified.
❌ BEFORE (Async)
User → Verify → ✅ Verified
                ↓
    EventBridge → SQS → Fraud Lambda
                ↓
        ⚠️ Flagged (too late!)

Problem: Villain already got verified before fraud detection runs

✅ AFTER (Inline)
User → Verify
        ↓
Check Duplicate (GSI Query)
        ↓
    ❌ BLOCKED
(never gets verified)

Solution: Duplicate check happens BEFORE marking factor as verified

Hash-Based Detection
Data Type Method Accuracy Speed
Mobile Number SHA-256 of E.164 format ~100% ~10ms
Document Text SHA-256 of normalized fields ~95% ~20ms
Face (Pre-filter) pHash perceptual hash ~90% ~30ms
Face (Confirm) Rekognition CompareFaces ~99% ~200ms

Performance: Single DynamoDB GSI query per factor. Minimal latency impact (<10%).

Login Protection System

Multi-layer defense against brute force, credential stuffing, and distributed attacks

Layer 1

IP Rate Limiting

10 attempts/hour per IP

Block further attempts for 1 hour

Layer 2

Account Rate Limiting

5 attempts/hour per email

Lock account for 30 minutes

Layer 3

IP Blocking

20 attempts = 24h ban

Logged to SECURITY page

Layer 4

CAPTCHA

After 3 failed attempts

Prevent automated attacks

Attack Scenarios
Scenario 1: Single IP Brute Force
Attacker tries 20 passwords from 1 IP
→ After 10 attempts: IP rate limit
→ After 20 attempts: IP banned 24h
→ Logged to SECURITY page ✅
Scenario 2: Distributed Attack
Attacker uses 10 IPs, 2 attempts each
→ After 5 attempts: Account locked 30min
→ Target account protected
→ All attempts logged ✅
Scenario 3: Credential Stuffing
Attacker tries 1000 email/password combos
→ After 3 attempts: CAPTCHA required
→ After 10 attempts: IP rate limit
→ After 20 attempts: IP banned
→ Attack stopped ✅
Scenario 4: Legitimate User
User tries 4 wrong passwords
→ After 3 attempts: CAPTCHA shown
→ After 5 attempts: Account locked 30min
→ User clicks "Forgot Password"
→ Reset link sent ✅

Password-Protected Fraud Resolution

Security Requirement: Tenant Admins must enter their password to resolve fraud cases (NOT FRAUD or CONFIRMED)
Why Password Protection?
  • Prevents accidental clicks — No one-click fraud resolution
  • Confirms identity — Verifies admin is who they claim to be
  • Audit trail — Failed password attempts logged
  • Compliance — Meets security audit requirements
How It Works
  1. Admin clicks "NOT FRAUD" or "CONFIRM FRAUD"
  2. Password dialog appears with warning
  3. Admin enters password
  4. Backend verifies via Cognito AdminInitiateAuth
  5. ✅ Valid → Resolution applied + Audit logged
  6. ❌ Invalid → Error: "Invalid password"

Note: Password never logged. Failed attempts audited as "BLOCKED".

Fraud Case Review UI
┌─────────────────────────────────────────────────────────────┐
│  FRAUD CASE REVIEW                                          │
├─────────────────────────────────────────────────────────────┤
│                                                             │
│  [Liveness Photo]          [Document Face Photo]           │
│                                                             │
│  Extracted Document Fields:                                │
│  • NOME: João da Silva                                     │
│  • CPF: 123.456.789-00                                     │
│  • REGISTRO GERAL: 12.345.678-9                            │
│                                                             │
│  Duplicate Match Info:                                     │
│  • Type: DOCUMENT + FACE                                   │
│  • Face Similarity: 97.3%                                  │
│  • Original Profile: [link]                                │
│                                                             │
│  [ ✅ NOT FRAUD ]          [ 🚨 CONFIRM FRAUD ]            │
│  (requires password)       (requires password)             │
└─────────────────────────────────────────────────────────────┘

Tenant Isolation

Separation Strategy
  • Separate Tables: gg-profiles (internal) vs gg-external-profiles (external)
  • JWT with tenantId: Every request carries tenant context
  • Lambda Enforcement: 403 if jwt.tenantId !== resource.tenantId
  • GSI Filtering: All queries scoped to tenantId
  • Application Scoping: External users further scoped by applicationId
Security Guarantees
  • ✅ Tenant A cannot see Tenant B's data
  • ✅ External profiles cannot see internal profiles
  • ✅ No cross-tenant hash leakage
  • ✅ Application-level isolation within tenant
  • ✅ Physical table separation for external users
Result: Zero cross-contamination. Complete data isolation.