Skip to content

Detection Architecture

Evan Newman edited this page Nov 30, 2026 · 1 revision

Detection architecture

OodaTap detects autonomous and hybrid human+agentic OODA loops (Observe → Orient → Decide → Act) strictly from encrypted network metadata. Events are grouped per source host (src_ip) and scored across three orthogonal detectors before policy-aware verdict fusion.


Detector 1: Context-growth sawtooth (src/oodatap/detectors/sawtooth.py)

Autonomous LLM agents replay growing conversation transcripts (tool calls + tool outputs) on every turn until context compaction resets the prompt size, producing a distinctive uplink byte sawtooth paired with SSE token-streaming downlinks.

  • Per-endpoint scoring: Groups a host's TlsBurstEvent streams by endpoint key (sni or dst_ip:dst_port), evaluates each independently, selects the highest-scoring endpoint ((score, turn_count)), and records all endpoints scoring >= 0.30 in matched_endpoints.
  • Minimum turns: Requires n >= min_turns_for_sawtooth (default 4).
  • Compaction-cliff detection: Marks turn idx >= 1 as a compaction cliff when uplinks[idx - 1] >= 4000 bytes and uplinks[idx] < 0.65 * uplinks[idx - 1] (>35% sudden drop).
  • Segment-wise trend metrics (split at compaction cliffs, weighted across segments of length >= 3, falling back to full series):
    • Noise-tolerant Kendall's τ: Pair (i, j) (j > i) is concordant if u[j] - u[i] > 64 B, discordant if < -64 B.
    • Monotonic step ratio: Fraction of adjacent steps increasing by > 64 B.
    • Max growth ratio: Maximum segment ratio max(seg) / max(min(seg), 1).
  • SSE streaming downlink cadence (sse_stream_ratio): Fraction of turns with plausible TTFT (0.12s <= ttft_seconds <= 15.0s) and either multi-record small-chunk streaming (downlink_record_count >= 4 and average record <= 1800 B) or sustained decode duration (decode_duration_seconds >= 0.15s).
  • Composite sawtooth score:
    • tau_norm = clip((weighted_tau + 0.10) / 1.05, 0, 1)
    • mono_norm = clip((mono_ratio_weighted - 0.30) / 0.60, 0, 1)
    • growth_norm = clip((max_growth - 1.15) / 2.20, 0, 1)
    • raw = 0.34*tau_norm + 0.24*mono_norm + 0.20*growth_norm + 0.22*sse_ratio + cliff_bonus (0.08) + endpoint_bonus (0.07)
    • Flat-traffic damping: Multiplies raw by 0.35 if max_growth < 1.12 (suppressing steady non-growing HTTPS polling).

Detector 2: Cross-flow causal coupler (src/oodatap/detectors/coupler.py)

Measures whether North-South LLM inference completions directly drive East-West internal tool executions, and whether tool outputs flow right back into the next North-South LLM uplink turn.

  • Stream selection: Picks the host's busiest is_llm_endpoint stream with >= 3 turns (else overall busiest stream) so unrelated endpoints are never merged. Considers actions in {EAST_WEST_INTERNAL, DEV_LOCAL}. Requires >= 3 LLM turns and >= 2 actions.
  • Inter-turn cycle matching: For each consecutive turn pair (prev_turn, cur_turn):
    • Collects actions falling within [prev_turn.downlink_end_ts - 0.05, cur_turn.timestamp].
    • Dispatch lag: max(0, first_action.timestamp - prev_turn.downlink_end_ts) <= max_dispatch_lag_seconds (default 2.2s).
    • Observation lag: max(0, cur_turn.timestamp - max(a.end_ts)) <= max_obs_lag_seconds (default 2.5s).
    • Matching cycles record coupled_links, target hosts, protocols, and (on non-compaction turns with positive uplink delta) (sum(bytes_in), cur.uplink_bytes - prev.uplink_bytes) pairs for Pearson correlation (byte_delta_correlation, requiring >= 3 pairs).
  • Binned OLS Granger-causality F-test:
    • Bins LLM completion timestamps (cause) and action start timestamps (effect) into 0.5s bins (16 <= n_bins <= 20000) with max_lag = 4 (up to 2.0s).
    • Compares restricted autoregressive OLS (RSS_r) against unrestricted OLS adding cause lags 1..4 (RSS_u): F = ((RSS_r - RSS_u) / 4) / (RSS_u / (n_rows - 9)).
  • Composite coupler score:
    • raw = 0.30*obs_ratio + 0.30*dispatch_ratio + 0.22*max(0, byte_corr) + 0.18*(1 - exp(-granger_f / 6.0))
    • Scaled by sample count (0.35 + 0.65 * min(1, coupled_cycles / min_actions_for_coupling)), or 0.0 if coupled_cycles == 0.

Detector 3: Session kinematics & handoff change-points (src/oodatap/detectors/kinematics.py)

Analyzes East-West / local action timing geometry independently of TLS streams to separate autonomous agents from rapid scripted scanners and human operators—and to pinpoint mid-session Agent ↔ Human handoffs.

  • Parallel tool fan-out clustering: Groups consecutive actions starting within fanout_window_seconds (default 0.20s) into _ActionBurst clusters (requires >= 4 actions and >= 3 bursts).
  • Scanner regularity penalty: Computed on raw inter-action timestamp diffs when median < 0.35s and CV < 0.85 (scanner_regularity_score). High scanner regularity (>= 0.65) damps the kinematics score by (1.0 - 0.85 * scanner_regularity).
  • Exact BIC-penalized L2 optimal partitioning:
    • Builds standardized 2D burst features [log1p(gaps), fanout_flags * 1.5].
    • Runs dynamic programming (min_seg_size = 5, penalty 4.0 * ln(n)) with O(1) prefix-sum SSE cost to detect arbitrary non-monotonic regime shifts (including Agent → Human → Agent).
  • Per-segment regime classification:
    1. SCRIPTED_SCANNER: median_gap < 0.45s and CV < 0.85 and fanout_ratio < 0.85
    2. AUTONOMOUS_AGENT: (0.55s <= median_gap <= 8.5s and CV <= 0.72) or (fanout_ratio >= 0.25 and 0.45s <= median_gap <= 10.0s)
    3. HUMAN_OPERATOR: median_gap >= 7.5s or (median_gap >= 3.0s and CV > 0.72 and fanout_ratio < 0.15)
    4. IDLE_OR_MIXED: otherwise
  • Handoff emission: Any adjacent pair switching between AUTONOMOUS_AGENT and HUMAN_OPERATOR emits a HandoffEvent with timestamp, rationale, and confidence clip(0.45 + 0.12*log1p(gap_ratio) + 0.35*abs(fan_diff), 0.5, 0.99).
  • Composite kinematics score:
    • Combines autonomous action share (0.40), normalized fan-out ratio (0.30), inference-band size_to_pause_correlation (0.25, for 0.5s <= gap <= 15.0s), and +0.15 handoff bonus, damped by scanner_regularity.

Fusion engine & verdict decision tree (src/oodatap/detectors/engine.py)

  1. Weighted composite: 0.30 * sawtooth + 0.45 * coupler + 0.25 * kinematics (weights tunable via YAML policy).
  2. Off-box LLM fallback: If sawtooth.turn_count < min_turns_for_sawtooth AND kinematics.score >= 0.70 AND scanner_regularity < 0.45, raises composite to max(composite, 0.72 * kinematics.score).
  3. Verdict priority order:
    1. BENIGN_DEV_AGENT (suppressed_as_dev_agent = True):
      • Zero sensitive lateral actions, zero non-allowlisted internal actions, >= 2 dev-local actions, and (sawtooth >= 0.40 or coupler >= 0.35); or
      • Host IP listed in dev_allowlist.approved_dev_hosts with zero sensitive lateral actions and composite >= suspicious_threshold (0.40).
    2. SCRIPTED_AUTOMATION: scanner_regularity >= 0.65, sawtooth < 0.35, and coupler < 0.25.
    3. HYBRID_HUMAN_AGENT_INTRUSION / AGENTIC_OODA_INTRUSION: composite >= alert_threshold (0.58) AND (sensitive_lateral_actions > 0 or unique_internal_targets >= 2 or coupler >= 0.55). Emits HYBRID_HUMAN_AGENT_INTRUSION when handoffs is non-empty, otherwise AGENTIC_OODA_INTRUSION.
    4. SUSPICIOUS_LOOP: composite >= suspicious_threshold (0.40).
    5. BENIGN: Default fallback.

Reproducible 75-trace benchmark (oodatap benchmark --seeds 15)

Deterministic NumPy-seeded evaluation across 5 traffic classes (base_seed = 100):

Scenario Class Traces Alerts Exact Match Mean Composite Sawtooth Coupler Kinematics
human_admin 15 0 15/15 0.07 0.18 0.00 0.05
scripted_scanner 15 0 15/15 0.03 0.00 0.00 0.11
benign_dev_agent (suppressed) 15 0 15/15 0.85 1.00 0.88 0.60
autonomous_agent_intrusion 15 15 15/15 0.96 1.00 0.94 0.95
hybrid_human_agent_intrusion 15 15 15/15 0.93 1.00 0.97 0.77

Overall synthetic metrics: 100.0% Precision, 100.0% Recall, 100.0% F1, 0.0% Benign Dev-Agent FPR, and 100.0% Agent ↔ Human Handoff Recall.

Clone this wiki locally