Architecture Note · Security & Compliance

Email Security, Phishing & Wire-Fraud (BEC) Defense: Deterministic Forensics, ERP Bank Diffs, and Human SOC Gates

How deterministic header forensics, ERP vendor-master bank diffs, human-gated SOC purges, and SHA-256 hash-chained audit logs stop wire-fraud BEC and quishing.

The Operational Problem: High-Value Wire Fraud Inside Trusted Mail Threads

Treasury, accounts payable, and security operations teams face attacks that carry no malware payload at all. A Business Email Compromise (BEC) lure arrives disguised as a routine vendor settlement update—swapping a German DE89 SEPA IBAN for an external LT60 account on a EUR 485,000 retainer, altering a US ACH routing number, or using secrecy cues to bypass procurement portals. Simultaneously, QR-code phishing (quishing) lures embedded in images or PDFs evade traditional gateway URL rewriters and harvest session tokens across distributed regional offices.

Why Naive AI Wrappers Fail

Prompting a general-purpose cloud language model to flag suspicious emails introduces four structural weaknesses in high-stakes financial and SOC workflows:

  • Nondeterministic header and lookalike math: General LLM classifiers miss subtle structural spoofing—such as From vs. Reply-To or Return-Path splits, punycode (xn--) labels, Cyrillic or Greek confusables, and ASCII substitutions like rn for m—while producing inconsistent risk scores on identical message inputs.
  • Raw message egress: Forwarding full .eml files, vendor banking coordinates, and executive correspondence to external model APIs pushes sensitive financial metadata outside the enterprise boundary with unclear retention guarantees.
  • No grounding against ERP truth: An isolated email prompt cannot verify whether a requested IBAN, SWIFT-BIC, ABA routing number, UK sort code, or Australian BSB matches the firm’s verified vendor master, nor prevent staff from dialing a fraudulent callback number embedded in the attacker’s email signature.
  • Missing blast-radius and remediation controls: Unbounded automation cannot safely retract messages across dozens of global mailboxes or upgrade subsidiary DMARC policies without explicit human accountability and tamper-evident audit logs.

The Deterministic Architecture That Fixes It

A production BEC and phishing defense stack separates deterministic protocol checks, authoritative ERP comparisons, and human-gated containment into an auditable pipeline backed by SQLite in WAL mode and scoped invite authentication:

  1. Header, homoglyph, and quishing inspection (POST /api/mail/inspect): Accepts JSON headers/bodies or multipart .eml uploads parsed with Python’s standard-library email parser. The engine checks SPF, DKIM, and DMARC Authentication-Results, flags From/Reply-To/Return-Path mismatches, decodes punycode and Unicode confusables alongside ASCII folding and Levenshtein edit distance against protected domains, and inspects URL shorteners and QR/quishing cues. A provider-agnostic BaseBECAdapter defaults to OfflineDeterministicAdapter (offline-deterministic-v1) for zero-key local execution, while temporary .eml files are automatically purged after one hour (purge_expired_uploads).
  2. ERP vendor master diff and out-of-band callback gate (POST /api/bec/bank-verify): Normalizes and compares requested IBAN, routing, SWIFT, and account last-4 tokens against verified vendor_master records, alongside lookalike checks on the sender domain. Any discrepancy triggers HOLD_BANK_MISMATCH (or HOLD_UNVERIFIED_VENDOR) and emits a structured callback checklist pinned strictly to the master record’s pre-verified phone number—explicitly rejecting phone numbers supplied inside the email and requiring dual-control Analyst plus Controller sign-off before releasing held wires.
  3. DMARC posture monitoring and human-gated SOC actions (GET /api/dmarc/posture, POST /api/incidents/{id}/action): Aggregates subsidiary domain alignment rates, policy states (p=none, p=quarantine, p=reject), SPF 10-lookup limits, and unauthorized sender geolocations. High-impact containment actions—org_wide_purge, retract_all, and release_quarantine—enforce a strict human SOC confirmation gate, returning HTTP 409 Conflict unless human_confirmed=true, analyst_id, and a non-empty confirmation_note are supplied.
  4. SHA-256 hash-chained audit trail and safe exports: Every analyst and controller decision appends to an immutable SHA-256 hash-chained incident_actions ledger, covered by pytest suites on header/spoof parsing and exported via GET /api/incidents/export.csv as RFC 4180 CSV with spreadsheet formula-injection neutralization.

Operational Takeaway

Stopping wire-fraud BEC and quishing requires deterministic inspection, not probabilistic guesswork. By pairing zero-key header and homoglyph forensics with 1-hour ephemeral .eml cleanup, ERP vendor-master bank diffs, pre-verified callback gates, HTTP 409 human SOC purge enforcement, and SHA-256 chained audit logs, security and finance teams defend multi-currency approvals without surrendering custody or control.

Test deterministic BEC and DMARC controls on your own workflow

Start with a free 30-minute workflow check. Bring recent DMARC RUA reports or a redacted vendor bank-change workflow and leave with one concrete recommendation in writing within one business day.