Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/redteam-implementation.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ cap matrix, and ship the runbook.
| 5.6 | Mount-propagation rows: `rprivate` vs `ro,rslave` gauge asserts on Docker | rt-5-6 (**DONE 2026-12-04**: 15/15, BLOCKED — the rslave row holds, the regression guard is exact, and the rprivate failure mode is two defects: the real ns never collected + the host's socket inventory emitted under the tenant's name silently — the mode-0000 staging file → EACCES open → the collector proceeds anyway; see the findings row and `docs/security.md` "Minimum-capability recipe") |
| 5.7 | `/proc` pressure side effects | rt-5-7 (**DONE 2026-12-04**: 14/14, BLOCKED — at 10k host processes: scan p99 0.088s, no reconcile incompletes, coverage lag 0s, CPU 121%; the skipped counter's growth is exactly one-per-pid-per-scan, the docker-default AppArmor ptrace-read line) |
| 5.8 | RT-11 tier 3: docker.sock kill, host netfilter blind, netns flood via rslave, docker netns entry poisoning, UDS unlink/baseline poisoning in Docker topology | rt-11-9..13 (**DONE 2026-12-05** for rt-11-9..12: CONFIRMED/BLOCKED/CONFIRMED/BLOCKED — two new findings: the netns-flood daemon death (**#389**) and the docker.sock kill (a deployment-invariant finding — no product issue, the RUNBOOK rule is the defense); **rt-11-13 deferred after task 5.9** — it reuses the RT-6 rows in the Docker topology) |
| 5.9 | UDS suite: symlink attack, stale-socket unlink DoS, replacement race, secret-file modes audit, GOIP_WRITE_OUT confinement | rt-6-1..6 |
| 5.9 | UDS suite: symlink attack, stale-socket unlink DoS, replacement race, secret-file modes audit, GOIP_WRITE_OUT confinement | rt-6-1..6 (**DONE 2026-12-05**: BLOCKED/CONFIRMED/CONFIRMED/CONFIRMED/BLOCKED/BLOCKED — three findings: the stale-unlink footgun and the world-writable-parent hijack (**#400** — the private-parent-dir doc arm) and the baseline integrity gap (**#401**); rt-6-5 REFUTED its own premise — the listener already refuses group/world-readable secret files at startup |
| 5.10 | **Blind-detection runbook**: per cut link (discover/dump/enrich/batch/deliver/scrape/process) × tier, the metric/log that reveals it; external-watchdog requirement; written into `docs/security.md` + `vagrant/redteam/RUNBOOK.md` | RT-11 deliverable |

**Definition of done**
Expand All @@ -306,6 +306,7 @@ cap matrix, and ship the runbook.
- [ ] **Phase 5 part 3, first half complete (the propagation + pressure rows)**: rt-5-6 **BLOCKED** (15/15, `20261203T231843-b48e19d1e-3186309` — **the rslave row holds and the e13287e7b regression guard is exact (gauges 0/WARN silent on the row, gauges 1/WARN fired on an rprivate twin), but the rprivate failure mode is two defects, not the documented one**: a named netns created after the daemon started is never collected (no records for its listener in the twin's catcher — the /proc-scan fallback is also blind: docker-default AppArmor denies ptrace-read of unconfined host peers regardless of CAP_SYS_PTRACE, dmesg-evidenced), AND the twin emits misattributed records — `ip netns add(8)` stages the entry as a mode-0000 file over which rprivate never propagates the nsfs mount, so the resolver's readdir+fstat admits the bare FILE, the daemon's open fails EACCES (the counter that fires is `openAndSetNSWithRetries{variable="open"}` — setns is never attempted), and `netNamespaceInstance` proceeds anyway: the diag socket opens in its own (host) netns and gets stored as that namespace's collector, so the HOST's socket inventory flows under the tenant's name (~8.5k records/run, netnsInode = the file's tmpfs inode) — silently, every poll — a product issue to file; `rslave` guidance + the detectors are in `docs/security.md` and the RUNBOOK), rt-5-7 **BLOCKED** (14/14, `20261204T003453-b48e19d1e-3641655` — **bounded at fleet scale**: at 10k host processes the discoverNamespaces p99 is 0.088s (baseline ~0.005s, bound 1.0s), no `reconcile_incomplete` fires, victim coverage lag stays 0s through the flood and after the drain, daemon CPU 121% (<250% bound) with RSS +27MB, and the skipped counter's growth is exactly one-per-pid-per-scan (+179,912 over 21 scans) — the docker-default ptrace-read line again, no retry storm. Two more pipefail-in-assignment silent-death lessons encoded (guard every grep pipeline feeding a `$()`, bound curls and docker stats with timeouts), and the twin's metrics/logs/mountinfo snapshot before asserting — the counters overturned the first mechanism theory.
- [ ] **Phase 5 part 3, second half complete (the RT-11 tier-3 rows)**: rt-11-9 **CONFIRMED** (11/11, `20261204T104157-ad321054a-3536908` — **the one-line full blind: the docker socket is uid-equivalent root** — a plain curl via the bind-mounted socket POSTs the daemon to `stop` (204), or `pkill -9` over --pid host; no daemon-side counter can exist (the daemon is dead — /metrics 000, the catcher freezes); the socket restarts it too — the attacker owns lifecycle in both directions; the plain tier has neither vector, which IS the invariant, and the external arrival check is the only detector), rt-11-10 **BLOCKED** (13/13, `20261205T020601-ad321054a-2280188` — **firewall tampering is only detectable via delivery health, and the counters DO page**: the deliver blind (OUTPUT DROP to :9999) freezes the catcher while the daemon stays healthy-while-dark; the envelope queue fills within ~30 s, queueFull + a `queue_depth` drop every poll after, Write/Dial on the 30 s deadline + 3×30 s dial cycle → the `attempts` drop (226 evictions over 480 s in the calibration run); rule-out → the queue drains, delivery recovers; the scrape blind (INPUT DROP to :9088) is absence-only by construction — no daemon-side counter can exist for its own exposition failing, the external watchdog is the detector, exactly as the RUNBOOK documents), rt-11-11 **CONFIRMED — #389 (S2)** (8/8, `20261205T023850-ad321054a-2612158` — **the netns flood KILLS the daemon**: the per-namespace collector inits (each holding a locked OS thread) pass the Go runtime's 2000-thread ceiling BEFORE the 4096 `-maxNetns` cap — `fatal error: thread exhaustion`, exit 2, the catcher freezes (the full-fleet blind); the admission bounds and the thread ceiling are mutually inconsistent — the cap sits ABOVE the budget; fix = cap under the thread budget, unlock after init, limit concurrent inits, or raise SetMaxThreads; the scenario's survives path is the regression guard), rt-11-12 **BLOCKED** (11/11, `20261205T032136-ad321054a-3074828` — **the entry-file poison is counted and pageable — and the #386 misattribution is the measured setns leg**: a drop+re-add poison (`ip netns del`, gap, `ln -s /dev/null`) makes the fresh collector's open succeed on the symlink and all 10 setns retries fail EINVAL (`Setns` +10, `SetnsAfterRetries` +1), then the caller PROCEEDS on fd -1 — host dumps under the tenant's name, 15 → 6679 records with the listener-port count frozen (the discriminator); the ro,rslave row daemon is untouched). rt-11-13 deferred after task 5.9 (it reuses the RT-6 rows). Harness lessons (all encoded, the big four): **matrix.sh leaves `RT_READ_TOKEN` EMPTY until `xtcp2_victim_read_token()` runs** — a scenario reading authed metrics without it reads a permanent 0 and can hang forever on a counter that never lights (rt-11-10 runs 1–3); **`|| echo 000` double-prints on one line** (curl -w's 000 has no trailing newline — `000000`, which tail -n1 cannot dedupe; the fix is `|| true` + exact equality); **every metric read through a possibly-DEAD daemon is a vacuous 0** — check liveness first, and a monotonic counter that appears to decrease is a dead-scrape proof (rt-11-11 run 1); **the /run/netns entry file IS the nsfs bind mount** — `rm -f` fails EBUSY (the drop must be `ip netns del`; pre-clean idempotently, or the next `ip netns add` collides). **Final regression: the 48-row matrix pending before the PR merges.**
- [x] rt-11-12 (netns entry poisoning) resolves BLOCKED (errors counted + gauge) or CONFIRMED (silent drop → S2 issue). (DONE 2026-12-05, 11/11 BLOCKED `20261205T032136-ad321054a-3074828`: the failure IS counted — `Setns` +10 and `SetnsAfterRetries` +1 at the re-add — and the measured shape is the #386 misattribution setns leg: host dumps under the tenant's name, 15 → 6679 records with the listener-port count frozen; the per-ns gauge gap stays #371)
- [x] **Phase 5 part 4 complete (the UDS suite)**: rt-6-1 **BLOCKED** (13/13, `20261205T181303-4a9a9345b-3515947` — **all three shapes refused, nothing clobbered**: a symlink, a regular file, and a symlink pointing at a LIVE socket (the sneakiest — following it would stale-unlink the real one) all exit 1 with the by-name 'exists and is not a socket' at startup; the attacker's files survive untouched — the Lstat never follows, the unlink policy never runs), rt-6-2 **CONFIRMED — #400 (S3)** (10/10, `20261205T181938-4a9a9345b-3973716` — **the default stale-socket policy unlinks a LIVE service's socket, no liveness probe**: a socat victim on a shared dir is orphaned on an unlinked inode (inode changed, the victim's echo gone, the twin answers /healthz 200 on the victim's path) while its PROCESS still runs — the DoS is silent; `unlinkStale=false` refuses by name and the victim survives — the regression guard for the #400 fix), rt-6-3 **CONFIRMED — #400 (S3)** (10/10, `20261205T201441-4a9a9345b-1022919` — **the chmod enforcement is real, the world-writable parent is the hole**: the daemon's own created dirs are 0750 (socketDirMode) and the sockets 0600 (DefaultUnixSocketMode), a non-root process IN THE SAME CONTAINER (docker exec -u 1000) cannot unlink from them — but chmod 777 (the operator mistake) hands the path to the attacker: their fake socket owns it, the probe answers 'rt-6-3-attacker', the daemon never notices (its listener is orphaned, not dead) — the documented requirement: dir 0700 owned by the daemon user), rt-6-4 **CONFIRMED — #401 (S3)** (17/17, `20261205T212243-4a9a9345b-1502677` — **the two shapes split exactly**: the CORRUPT baseline degrades safely (gauge 0, counted, /healthz 200, TCP collection UNAFFECTED — the runLinkMonitor contract, now repeated on Ubuntu/Docker), while the CRAFTED-VALID baseline is accepted with no integrity check and drives `go_link_monitor_up_links_delta = -99997` — a fake ~100k 'links missing' alert from ONE file write; `expected_up_links` is the poison lever), rt-6-5 **BLOCKED** (10/10, `20261205T221425-4a9a9345b-1938524` — **the plan's premise is STALE**: the listener REFUSES a group/world-readable secret file at startup ('a secret file must not be accessible by group or others', chmod 0400, Kubernetes defaultMode: 0400) — the row's 'consider refusing world-readable secret files at startup' is already the product behavior, so the verdict is BLOCKED, not CONFIRMED; the read-side audit stands: the 0644 file is still world-readable ON THE MOUNT (the refusal stops the use, not the read), and the 0400 twin starts and serves — the working reference), rt-6-6 **BLOCKED** (14/14, `20261205T235143-4a9a9345b-2820953` — **the confinement holds on every axis**: with GOIP_WRITE_OUT the write verbs (the goip_write build docker-cp'd into the daemon's own container — the rt-5-3 busybox pattern) write the request FILE only — the loopback flags, the route table, and the daemon all unchanged; without the variable the verbs refuse outright (ErrWriteNotApplied, exit 1); the /ip listener is OFF by default (404) and with -linkMonitorIPPaths the read verbs serve (200) while the write verb /i/l/s/dev/lo/down is refused 400 BY NAME — with no write encoder in the binary (no-write-encoders, the flake check). Harness lessons (all encoded, per-run): a bind-mounted socket dir is DOCKER'S (0755), not the daemon's — the 0750 socketDirMode only applies to dirs the daemon creates itself, so the enforcement leg must mount nothing (rt-6-3 runs 1–4); a class is served by exactly ONE listener (metrics+metrics is a config error, `ip` needs -linkMonitorIPPaths, `debug` needs an admin credential — grpc-read is the flagless read class); a twin with NO -dest runs the KAFKA default and dies of redpanda dial retries ~30 s in (every twin runs -dest tcp:127.0.0.1:9999, the row's catcher); the expected-refusal exit code must be captured with the &&/|| idiom, never the bare $? after the command (set -e kills the scenario first — rt-6-6 run c); and goip's loopback prints 'state UNKNOWN' — the up/down signal is the flags list, not the state keyword). **Final regression: the 54-row matrix on the branch head `aebef83a1` — 53/54 PASS + rt-4-6 FAIL (`20261206T020955-aebef83a1-3637319`, `only 79 churn cycles` — a harness-side driver underrun, the target ~240; NOT a product regression, the assert fired on the driver's own telemetry). Solo re-run of rt-4-6 on the same commit: PASS 16/16 (`20261206T032052-aebef83a1-4118058`), identical to the green 48-row run of task 5.8 — the flake is the driver's, not the daemon's.**
- [x] RUNBOOK.md complete for all 7 links × 4 tiers (28 cells), each naming a concrete metric/log/absence-alert. (DONE 2026-12-03, `8053629d5`: `vagrant/redteam/RUNBOOK.md` — every cell names its detector, evidence cited (V) for every cell as of 2026-12-05 — the last four (rt-11-9..12) landed their measured evidence when task 5.8's rows ran; rt-11-11's cell is V-CONFIRMED/#389, rt-11-12's open question is answered in the gaps section. First rule, alert rules 1–8, and the known gaps #337/#370/#371 up front; docs/security.md carries the companion section.)
- [ ] Missing-gauge issues from Phase 4 all closed or scheduled with owners.
- [ ] §29 integration: `ubuntu-fleet/` rows that overlap (bonding/rxe) run against the same base without duplicating provision scripts.
Expand Down
12 changes: 6 additions & 6 deletions docs/redteam-plan.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,12 @@ and measure blast radius if the daemon process itself is compromised.

| ID | Scenario | Steps | Expected today | Pass criteria | Severity if failed |
|---|---|---|---|---|---|
| rt-6-1 | UDS symlink attack | pre-create symlink at `/run/xtcp2/grpc.sock` path | refused (existing regular file/symlink refused) | startup fails safely | S4 regression |
| rt-6-2 | Stale-socket unlink DoS | point `-grpcListenAddress` at another live service's socket path in a shared dir | daemon unlinks it without liveness probe (documented) | other service's socket removed ⇒ documented footgun; pass criteria = finding + issue (liveness probe or refuse-by-default), plus doc: private parent dir | S3 (documented) |
| rt-6-3 | Socket replacement race | attacker in same container swaps socket file after bind (world-writable parent) | no protection if parent dir is shared | hijack succeeds ⇒ documented requirement: dir `0700` owned by daemon user; scenario asserts chmod enforcement | S3 |
| rt-6-4 | Baseline poisoning | write crafted/corrupt baseline into bind-mounted `/var/lib/xtcp2` | corrupt baseline degrades monitor only (NixOS VM check exists; repeat on Ubuntu/Docker) | TCP collection unaffected; monitor down gauge set; crafted-but-valid baseline may fake alerts — assess whether integrity check (hash/mode) is warranted | S3 |
| rt-6-5 | Secret-file permission audit | ship token files 0644 in image/mount; check who reads | loader does not check file modes (documented) | finding: assert+document 0400 root-owned requirement; consider refusing world-readable secret files at startup | S3 |
| rt-6-6 | `GOIP_WRITE_OUT` abuse | run goip write verbs in-VM | request files written to configured path only, no kernel change | no write path reachable from any listener/API | S4 |
| rt-6-1 | UDS symlink attack | pre-create symlink at `/run/xtcp2/grpc.sock` path | refused (existing regular file/symlink refused) | startup fails safely | **VERIFIED 2026-12-05 (BLOCKED, 13/13, `20261205T181303-4a9a9345b-3515947`)**: all three shapes refused — a symlink, a regular file, and a symlink pointing at a LIVE socket (the Lstat never follows, so the stale-unlink policy never reaches the real one); the daemon exits 1 with the by-name 'exists and is not a socket'; the attacker's files survive untouched | S4 regression |
| rt-6-2 | Stale-socket unlink DoS | point `-grpcListenAddress` at another live service's socket path in a shared dir | daemon unlinks it without liveness probe (documented) | other service's socket removed ⇒ documented footgun; pass criteria = finding + issue (liveness probe or refuse-by-default), plus doc: private parent dir | **VERIFIED 2026-12-05 (CONFIRMED, 10/10, `20261205T181938-4a9a9345b-3973716`)**: the default policy unlinks a LIVE service's socket (inode changed, the victim's reply gone, the twin answers /healthz on the path) — the victim process still runs, the DoS is silent; `unlinkStale=false` refuses by name and the victim survives (the regression guard). **Issue #400** + the private-parent-dir doc arm | S3 (documented) |
| rt-6-3 | Socket replacement race | attacker in same container swaps socket file after bind (world-writable parent) | no protection if parent dir is shared | hijack succeeds ⇒ documented requirement: dir `0700` owned by daemon user; scenario asserts chmod enforcement | **VERIFIED 2026-12-05 (CONFIRMED, 10/10, `20261205T201441-4a9a9345b-1022919`)**: the enforcement is REAL — the daemon's own created dirs are 0750, the sockets 0600, a non-root process in the same container cannot unlink from them; the world-writable parent (the operator mistake) is where the hijack succeeds — the attacker's fake socket owns the path, the client answers 'rt-6-3-attacker', the daemon never notices (orphaned, not dead). The documented requirement + **#400** | S3 |
| rt-6-4 | Baseline poisoning | write crafted/corrupt baseline into bind-mounted `/var/lib/xtcp2` | corrupt baseline degrades monitor only (NixOS VM check exists; repeat on Ubuntu/Docker) | TCP collection unaffected; monitor down gauge set; crafted-but-valid baseline may fake alerts — assess whether integrity check (hash/mode) is warranted | **VERIFIED 2026-12-05 (CONFIRMED, 17/17, `20261205T212243-4a9a9345b-1502677`)**: the corrupt shape degrades exactly as documented on Ubuntu/Docker (gauge 0, counted, /healthz 200, TCP collection unaffected); the CRAFTED-VALID shape is the finding — `expected_up_links: 99999` is accepted with no integrity check and drives `go_link_monitor_up_links_delta = -99997` — a fake ~100k 'links missing' alert from one file write. **Issue #401** | S3 |
| rt-6-5 | Secret-file permission audit | ship token files 0644 in image/mount; check who reads | loader does not check file modes (documented) | finding: assert+document 0400 root-owned requirement; consider refusing world-readable secret files at startup | **VERIFIED 2026-12-05 (BLOCKED, 10/10, `20261205T221425-4a9a9345b-1938524`)**: the premise is STALE — the listener REFUSES a group/world-readable secret file at startup ('a secret file must not be accessible by group or others', chmod 0400, Kubernetes defaultMode: 0400); the 'consider refusing' is already the product behavior. The read-side audit stands: the 0644 file is still world-readable ON THE MOUNT (the refusal stops the use, not the read) — the 0400 twin starts and serves (the working reference) | S3 |
| rt-6-6 | `GOIP_WRITE_OUT` abuse | run goip write verbs in-VM | request files written to configured path only, no kernel change | no write path reachable from any listener/API | **VERIFIED 2026-12-05 (BLOCKED, 14/14, `20261205T235143-4a9a9345b-2820953`)**: with `GOIP_WRITE_OUT` set the write verbs (run from the daemon's own container) write the request file only — the loopback flags, route table, and daemon all unchanged; without the variable the verbs refuse outright ('goip never applies a write', exit 1); the /ip listener is OFF by default (404) and with `-linkMonitorIPPaths` the read verbs serve (200) while the write verbs are refused 400 BY NAME, with no write encoder in the binary (no-write-encoders, the flake check) | S4 |

### RT-7 Artifact and supply-chain attacks

Expand Down
Loading