Skip to content
Merged
6 changes: 4 additions & 2 deletions docs/redteam-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,10 +268,12 @@ completing the RT-4 suite and RT-11 tiers 1–2.
- [x] Phase 4 part 2 complete (the stream/gRPC suite): rt-4-3 **BLOCKED** (11/11 — read-cred oversize answered PermissionDenied at the method ACL before the 4 MB cap is even reachable; admin-cred oversize answered ResourceExhausted; a 10×20 reading storm cost a linear 299 goroutines, 1.1 M records, no leak 71→299→71), rt-11-3 **CONFIRMED** (11/11 — **the strongest RT-11 crossover**: ONE never-reading authenticated stream took the catcher 1993 → 0 lines/6 s; `flatRecordServiceSend`'s blocking per-client Send runs per record on the decode hot path, so one stalled stream backpressures the whole fleet; API stayed 200 — the tier-2 split; recovery ≤6 s, no leak), rt-4-4 **BLOCKED** (11/11 — RSS slope −17 KiB/s under 4 paced readers, and the backpressure finding: the catcher collapsed 1494 → 0 lines/6 s with EXACTLY 32 records in 240 s — the paced wedge, same root cause as rt-11-3), rt-2-9 **CONFIRMED** (7/7 — stream-expiry carry-over: 2158/2200 records flowed ~50 s past the skew-0 window; file-don't-fix, ops note: key rotation does not break held-open streams). New tool: grpcstorm (storm/oversize/wedge/paced/HMAC shapes, static, in the attacker tools tar); new deploy axis `XTCP2_PPROF` (a loopback, token-gated debug listener for goroutine-count asserts — an observability axis, not a surface change); rt-2-2's Phase-4 deferral landed as row rt-2-9. Full matrix regression: **30 scenarios, 29 PASS + 1 harness race fixed + re-verified solo** — rt-2-2's in-minute replay minted at :44 and the tcpdump window pushed the replay past the boundary (correct 401 under skew 0; the assert raced, not the product): the guard now lands the mint at 05..18 and re-mints once if a slow provision still crosses.
- [x] Phase 4 part 3 complete (the delivery-outage suite): rt-4-7 **BLOCKED** (15/15, the split verdict — the s3 queue sink: RSS slope 70 KiB/s, the outage counted (`destS3Parquet/upload/error`, `s3_dropped_total=8`), recovery on endpoint return (objects 1270→2375); the tcp half: the permanent blind measured — counters light immediately, polling continues, the catcher restart changes nothing, only a daemon restart re-dials), rt-11-4 **BLOCKED** (14/14 — 300,008 thief sockets, victim coverage lag 0 s (parallel per-netns dumps + the 1 s poll-timeout valve), PollTimeout firing every cycle, RSS 29→31 MiB, and the amplifier at scale: 211,244 lines/6 s ≈ 100× baseline; the walkable budget engaged `xtcp_poll_degraded_total{level="sample"}` with victims still at 0 s lag), rt-11-5 **CONFIRMED** (16/16 — the L2 freeze: a CAP_NET_RAW sibling ARP-blackholes the sink via a 200 ms gratuitous-reply loop; the poller FREEZES in the blocked Write (no deadline, sync on the poll goroutine) for the whole retransmit window (~15.4 min at the prod default) with zero error counters and scrape 200; de-poison mid-window = full catch-up with no loss; the window closed = counters light + delivery permanently dead). New tool: arppoison (static, in the attacker tools tar); new deploy axes `XTCP2_MAX_RECORDS` (rt-11-4's walkable budget) and `XTCP2_SINK_IP` (rt-11-5's dedicated sink alias — poisoning the gateway takes the docker-proxy replies down with it, measured); the freeze finding filed as #345. Full matrix regression: **33 scenarios, 32 PASS + 1 tool race fixed + re-verified solo** — rt-4-3's oversize probe (leg B) raced the transport's arrival-based recv-limit kill against a fanned-out record beating the 8 MB frame on a fresh slow-start conn (measured OK 3/3 in the matrix, ResourceExhausted 12/12 by hand): the probe now drains Recv to the terminal verdict.
- [x] **Product fixes #345 + #339 landed with the expectation flips in the same change** (the S2 pair the delivery-outage suite surfaced): the tcp destination is now a bounded queue + worker — `Send` never blocks (the poller can never freeze on the sink), every write AND dial carries `tcp_write_timeout` (config field 120, validate-gted/lte'd to [1s, 1h], Go belt `resolveTCPWriteTimeout`, default 30 s, CLI `-tcpWriteTimeout`/`TCP_WRITE_TIMEOUT` env), the queue is `envelopeQueue` shared with s3 (moved untagged to destinations_queue.go — tcp is in every flavor including stdlib-only), and a failed write reconnects under full-jitter backoff (the `backoffWindow` cap derived like s3's: clamp(poll_frequency/10, 1s, 1h)) with 3 attempts per envelope, then drop-and-count. New counters: `xtcp_tcp_dropped_total{reason}` / `_bytes_total` / `xtcp_tcp_buffered_bytes{stage}` + `destTCP` Dial/Reconnect/queueFull/dropped. Verified by the same attacks that pinned the bugs: **rt-11-5 MITIGATED 18/18** (polls keep issuing through the stall 25→47/32 s — the freeze gone; Write/error=9, Dial/error=8, drops=3 while dark; de-poison heals with NO restart, reconnects=1; second cycle repeats — a REACHABLE neighbor entry ignores gratuitous ARP until STALE ~30 s, the flip is now a bounded wait) and **rt-4-7 BLOCKED 15/15** (the catcher restart heals delivery, reconnects=1, 2482 lines/6 s — no daemon restart). Harness: deploy axis `XTCP2_TCP_WRITE_TIMEOUT` (Vagrantfile arg 12). Harness lesson: `promLabels` order is function, VARIABLE, type — `WithLabelValues("destTCP","Write","error")` emits `type="error",variable="Write"`; grep the emitted order or the assert reads empty. Post-merge regression: **33/33 on main `14d7e1c38c` (PR #352)** — the first full-matrix sweep hit an environmental cascade (unattended-upgrades grabbed the dpkg frontend lock at scenario 24 — the last five scenarios failed provisioning in a row; `common.sh` now stops/masks the apt-daily timers and waits out an in-flight run, re-verified across all 33 provisions), and rt-11-5's dark window needed the two-shape accept: the write deadline can let a re-dial's broadcast ARP beat the poison — delivery SELF-HEALS mid-attack (1262 lines/6 s, drops=0, evidence `20261127T065504-195d45c15-839055`) — a stronger mitigation than the sustained stall the assert had pinned as the only valid shape (re-verified 18/18 MITIGATED shape-A, `20261127T071651-195d45c15-986471`).
- [ ] 24 h churn variant runs clean overnight once (logged evidence), or its blocker filed. (Phase 4 part 4)
- [ ] 24 h churn variant runs clean overnight once (logged evidence), or its blocker filed. (Phase 4 part 4 — the variant is built and env-gated: `RT_CHURN_SECS=86400 nix run .#redteam-rt-4-6`; the asserts are ratio/bound-based, and the stores/dels observability check is informational — a 24 h window SEES the 6 h ticker fire, which is not a failure; the overnight run itself is outstanding)
- [x] rt-11-5 shows delivery metrics lighting up during the L2 kill (assert specific series non-zero), or files the observability gap. (landed with the #345/#339 fix: the scenario asserts `destTCP` Write/Dial errors ≥1 while dark and — shape A — `xtcp_tcp_dropped_total` ≥1; the silent window is now counted, verified both cycles)
- [x] Phase 4 part 4 (conntrack leg): rt-11-6 **BLOCKED** (17/17, shape A `20261128T031048-c0f904e3d-3955865`; shape B 16/16 `20261127T232913-b7769a466-1209893`): the spray cannot stop reporting — established delivery immune, the re-dial races the slot leak and the #352 queue bounds the loss (both shapes green), no restart, polls never stop. The measured crossover is the ops view: a fresh scrape via docker-proxy needs a conntrack entry, so /metrics goes 000 while records flow — "absence of metrics must itself alert" confirmed end-to-end; harness lessons (mgmt-/24 NOTRACK, pgrep self-match, session-hold hang) encoded in-scenario.
- [x] rt-11-7 **survives** (18/18, `20261129T091855-df22997b2-1827895`): a NET_ADMIN co-tenant builds pathological-but-legal own-netns state on the new locality deploy axis (`XTCP2_ENRICH=locality` — a rtnetlink listener inside every discovered netns); 87 links / 976 corpus neighbors / 1012 routes at the kernel's own extremes (15-char names, 255-char labels, metric 0/4294967295, 32-nexthop multipath, v6 zero-MAC), the listener parsed **+1141 corpus events live** and a forced ROUTE event re-dumped the full corpus (snapshot periodic 1→2) — no panic, no restart, scrape 200, catcher grew through the build. No fixture needed. Measured coverage finding: localityGroups excludes GroupNeigh — the deployed daemon never reads neighbor tables; the plan's "huge neighbor tables" leg was NOT exercised — the pathological-MAC corpus is kernel-resident only (a fixture seed for the day the enricher reads neighbors). Harness: dpkg-lock-era VM disk full (catcher 5.8 G + docker json logs 8.1 G) fixed at the source — common.sh truncates both at provisioning.
- [x] rt-11-7 **survives** (18/18, `20261129T091855-df22997b2-1827895`): a NET_ADMIN co-tenant builds pathological-but-legal own-netns state on the new locality deploy axis (`XTCP2_ENRICH=locality` — a rtnetlink listener inside every discovered netns); 87 links / 976 corpus neighbors / 1012 routes at the kernel's own extremes (15-char names, 255-char labels, metric 0/4294967295, 32-nexthop multipath, v6 zero-MAC), the listener parsed **+1141 corpus events live** and a forced ROUTE event re-dumped the full corpus (snapshot periodic 1→2) — no panic, no restart, scrape 200, catcher grew through the build. No fixture needed. Measured coverage finding: localityGroups excludes GroupNeigh — the deployed daemon never reads neighbor tables; the plan's "huge neighbor tables" leg was NOT exercised — the pathological-MAC corpus is kernel-resident only (a fixture seed for the day the enricher reads neighbors). Harness: dpkg-lock-era VM disk full (catcher 5.8 G + docker json logs 8.1 G) fixed at the source — common.sh truncates both at provisioning; xtcp2_deploy truncates BEFORE the tarball scp (a full disk killed the delivery itself); tcp-stress NUL-byte stdout capped (`--log-opt max-size`) — the work containers had filled 4.0 G each.
- [x] **Phase 4 part 4 complete (the churn/cgroup suite)**: rt-4-6 **BLOCKED** (16/16, `20261130T041837-848ebbe00-1287288` — 149 netns add+del cycles in 240 s, poll_sockets 237→7875, CPU 111–114% of 4 vCPUs, victim flowing MID-storm, `reconcile_incomplete` 0→0; post-storm convergence go_goroutines 51→51 / FDs 53→53 / poll_sockets 245 — no leak; **finding #370: netns add/del is invisible in metrics**, the per-poll reconcile drops its deltas, mapReconciler's stores/dels only fire on the 6 h ticker — measured via `reconcile/start` ~1/poll, not the run's original +14730 figure, which was the Deserialize/start series read through an ambiguous `variable="start"` match), rt-11-8 **BLOCKED** (18/18, `20261130T042718-848ebbe00-1464077` — 20 `docker restart` cycles each re-packing 10000 sockfill pairs (poll_sockets 241→20244): mid-storm victim lag 0 s, reconcile p99 0.00032 s, `add_rate`=0, no leak — self-churn does not even register; review correction: run 1's `add_rate`/`reconcile_incomplete` zeros were read through a broken msum — the awk `$1` escaped twice expanded locally to the series name, the syntax error hidden by `|| echo 0` — the fixed helper re-measures them), rt-4-8 **BLOCKED** (16/16, `20261130T045657-848ebbe00-1525702` — the refocused cgroup-cap variant, XTCP2_CPUS=2, both quota bounds derived from it: an admin TriggerPollBurst 120×1 s multiplies records 116→491 rec/s (~half the 1 s-floor ticker, half the burst — the total forced cadence) while CPU stays 130.9%/132.0% vs the 210% quota bound, RSS 24453→27002 kB, no OOM, metrics answers, rate settles once the poke counter proves burst completion (run 1 sampled mid-burst at ~3× the baseline, right at the old bound); the nuance: the forced cadence multiplies RECORDS not CPU — the record-volume residual is #342's family; prod guidance: pin XTCP2_CPUS). All three reviewed and fixed (the review caught four wrong-reason asserts; re-verified solo: rt-4-6 16/16 `20261130T215441-7b4e3808e-453165`, rt-11-8 18/18 `20261130T220551-7b4e3808e-718451`, rt-4-8 17/17 `20261130T221109-7b4e3808e-764112`) and then the full matrix re-run: **38/38 PASS, 0 failed** on the branch head `8a2d69078` (matrix run `20261201T000311-8a2d69078`). The 24 h churn variant is env-gated (`RT_CHURN_SECS=86400 nix run .#redteam-rt-4-6`, never a matrix default) — the asserts are ratio/bound-based, the stores/dels check informational.
- [x] **Task 4.11 wrap-up (the observability enabler)**: of the four gauges the suite needs, three already exist and are now asserted in-scenario — FD usage (`process_open_fds`, the standard collector), goroutines (`go_goroutines`), poll-cycle duration (`Poller/pollToDoneDuration` + `PollTimeout`), delivery errors (`destTCP/Write/error`, `destS3Parquet/upload/error`, `Poller/envelopeFlush/error`); per-namespace coverage lag does NOT exist (aggregate-only) — filed as **#371**; the NEW measured gap — netns churn invisibility — filed as **#370** (the per-poll reconcile's add/del deltas are dropped).
- [ ] Every scenario traps cleanup; a final "victim still reporting" assertion runs after each attack (the RT-11 invariant).
- [ ] The wire-the-limits issue (max_connections/accept-rate) has measured evidence attached.

Expand Down
Loading