Dev.to Security 🔐 Cybersecurity 👁 0 📖 3 min read

ClearLens v1.0.0: Zero-Backend BEC Incident Triage, Outbound DLP, and Multi-Currency Net-Loss Reconciliation

When a finance team or incident responder enters the first 72 hours of a Business Email Compromise (BEC) vendor-invoice interception or wire-diversion incident, three operational mistakes show up repeatedly: Uploading

When a finance team or incident responder enters the first 72 hours of a Business Email Compromise (BEC) vendor-invoice interception or wire-diversion incident, three operational mistakes show up repeatedly:

  1. Uploading raw evidence to cloud SaaS tools: Pasting spoofed invoices, bank statements, or internal account numbers into web PDF converters or cloud chat assistants leaks confidential financial PII outside legal privilege.
  2. Accidental operational tip-offs (Outbound DLP gap): Sending an unvetted external reply that mentions SWIFT recall, police report, freeze order, or an unmasked OTP/IBAN warns the threat actor to disperse funds across downstream accounts before bank holds land.
  3. Double-counted multi-currency exposure: Corporate treasuries routinely sweep liquidity across internal same-entity accounts (for example, EUR -> HKD) right before executing an external wire. Summing every debit line counts internal FX sweeps alongside external wires, inflating reported loss numbers and stalling bank compliance intake.

To solve all three without running a server or installing third-party packages, I open-sourced ClearLens (v1.0.0) under the MIT License.

Architecture: default-src 'none' Browser RAM + Python Stdlib CLI

ClearLens ships both as a self-contained HTML/JS workbench (web/app.html) that runs completely offline from a local folder or air-gapped jump box, and as a zero-dependency Python >= 3.10 CLI (clearlens).

Every HTML entrypoint enforces a strict offline Content-Security-Policy (default-src 'none', blocking outbound fetch, XHR, WebSockets, remote fonts, and third-party scripts) which you can verify directly from the CLI:

# Install on macOS / Linux via Homebrew
brew install Ziqi/tap/clearlens

# Or run from a clean source checkout
git clone https://github.com/Ziqi/clearlens.git
cd clearlens

# Verify strict offline CSP and zero remote subresources across web/*.html
python3 -m clearlens verify ./web

What the Four Triage Cabins Do

1. Severity Triage, Persistence Checklist & ISO Checksum Extraction

Cabin 01 classifies the operational window (Active Compromise, 72h Recall Window, or Post-Incident Audit), walks responders through six persistence checks (silent mailbox forwarding rules, rogue OAuth grants, remote-access agents, SIM call diversion, and freezing outbound bank rails without closing the receiving account), and extracts mathematically valid payment identifiers (ISO 13616 IBAN Mod-97, ISO/IEC 7812 Luhn, and ISO 9362 SWIFT/BIC) locally in browser RAM.

2. Defensive Outbound DLP Pre-Flight Guardrail

Before anyone sends a holding reply to a suspected spoofed vendor thread, Cabin 02 (and clearlens dlp-scan) checks the draft for operational tip-off vocabulary, leaked OTP codes, unmasked card/IBAN strings, and confrontational phrasing, returning a deterministic PASS_CLEAN, WARN_REVIEW, or BLOCK_OUTBOUND verdict:

python3 -m clearlens dlp-scan \
  --text "Invoice INV-2026-8841 is queued in routine settlement review." \
  --strict

3. Multi-Currency Ledger Reconciliation & Internal FX Sweep Stripping

Using decimal.Decimal arithmetic (never IEEE-754 floats), Cabin 03 and clearlens ledger separate external fraudulent wires from internal_transit same-entity FX conversions and held_by_risk_control suspense items so net exposure matches actual external outflow:

# Run the built-in synthetic BEC scenario (Apex Maritime GmbH / SYN-BEC-2026-041)
python3 -m clearlens demo

# Reconcile multi-currency JSON with keyed HMAC payer pseudonymization
python3 -m clearlens ledger --demo --base-currency USD --redact

4. Dual-Mode Print-Ready A4 Recall Schedules

From a single reconciled ledger, Cabin 04 renders two native @media print A4 views:

  • Full Bank SWIFT Recall & Law-Enforcement Schedule (preserving full internal and external routing identifiers for formal bank recall tickets);
  • Redacted External Counsel / Counterparty Brief (pseudonymizing internal treasury accounts while keeping external beneficiary identifiers intact).

Try the Synthetic BEC Dataset in 10 Seconds

You can open https://ziqi.github.io/clearlens/app.html and click Load Synthetic BEC Demo in the top bar (all bundled entities such as Apex Maritime GmbH, Harborline Bunker Supply Co, DE89370400440532013000, and GB82WEST12345698765432 are 100% synthetic ISO/RFC test vectors), or verify the signed offline release zip with GitHub CLI:

gh attestation verify clearlens-offline-v1.0.0.zip --repo Ziqi/clearlens

ClearLens also pairs cleanly with starshield-forensics (our companion zero-dependency Python toolkit for offline browser storage prechecks and receipt container inspection). Feedback, edge-case multi-currency ledger schemas, and issues are very welcome on GitHub!

📰 Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.