Skip to content

redteam: Phase 5 part 2 — blast radius + cap matrix (rt-5-3/rt-5-4) + the blind-detection runbook - #382

Merged
randomizedcoder merged 4 commits into
mainfrom
feat/redteam-rt-5-1-rt-5-2
Dec 3, 2026
Merged

randomizedcoder merged 4 commits into
mainfrom
feat/redteam-rt-5-1-rt-5-2

Conversation

@randomizedcoder

Copy link
Copy Markdown
Owner

What this adds

Phase 5 part 2 of the red-team program (docs/redteam-plan.md rt-5-3/rt-5-4) plus two follow-on deliverables, on top of the already-merged part 1 (#376):

rt-5-3 — privileged-container blast radius (35/35 PASS, CONFIRMED)

An 8-probe busybox battery (docker-cp'd into the shell-less scratch daemon image and docker-exec'd — the takeover shape) against four shapes: the minimum-cap recipe, the §29 compose shape (docker defaults + 3 cap_add), --privileged --pid host, and a plain co-tenant.

The finding: a compromised daemon container is a host-trust domain in every cap shape — host link state is flappable and every mounted co-tenant netns enterable (NET_ADMIN+SYS_ADMIN are the collector's own powers; caps cannot minimize them away). What actually bounds mount and host-process ptrace on Ubuntu is the docker-default AppArmor profile, not the cap set; --privileged removes that bound entirely (mount, PID-1 environ, insmod-to-the-kernel). The min recipe's real win over the compose shape: drops MKNOD/DAC_OVERRIDE-class caps. A plain co-tenant is denied every host-mutating probe.

rt-5-4 — minimum-capability matrix (46/46 PASS, BLOCKED)

Six one-cap-dropped daemons (--cap-drop=ALL + per-row adds, otherwise the exact victim.sh host-mode shape) measured per feature:

  • NET_ADMIN / SYS_ADMIN drops → exit 1 with the actionable remediation message (the all-dropped floor names both fatal caps after all three WARN lines)
  • SYS_PTRACE drop → runs + WARN, the /proc-scan discovery goes fully blind (foundProc 5→0/scan — ptrace_may_access + Yama ptrace_scope=1) while netns coverage survives via the /run/netns + /run/docker/netns bind mounts (found/start stays 5/scan) — the init_capabilities.go "found stays at 1" claim is wrong in the docker shape, corrected in the docs
  • NET_RAW / SYS_RESOURCE drops → runs + WARN, zero degradation (udp dests and io_uring are the only consumers)
  • inet_diag, ethtool (the settings collector), the RDMA netlink backend, and the link monitor: unaffected by every soft drop

Delivered as the docs/security.md "Capabilities and container blast radius" section (cap × feature matrix, four-shape blast-radius table, minimum-cap recipe).

The 42-row matrix's one wobble — torn-read fix (d230761)

rt-11-4 FAILED in the first full matrix on a false "premise WON": victim_lag_s tails the live catcher while socat appends it, and the snapshot ended on a half-written record (JSONDecodeError: Unterminated string → the 999 sentinel read as a 999 s lag). Only tail's last line can be torn — the helper now parses the complete prefix ([:-1]) and retries once; rt-11-8 shares it verbatim. Re-verified solo: rt-11-4 14/14 (20261203T162907), rt-11-8 18/18 (20261203T163709).

The blind-detection runbook (task 5.10's deliverable, 8053629)

vagrant/redteam/RUNBOOK.md: the RT-11 answer's operational half — 7 links × 4 tiers, each cell naming the metric/log/absence-alert that reveals the cut, evidence cited or the row marked pending (rt-11-9..12). First rule up front: the daemon cannot be its own watchdog (rt-11-6's scrape-through-docker-proxy blind, rt-11-9's docker.sock kill) — the catcher-side arrival check and an external liveness watchdog are the primary detectors. Eight concrete alert rules; the known gaps (#337, #370, #371). docs/security.md gains the companion "Blind detection" section.

Verification

  • rt-5-3: 35/35 solo (20261203T093134-e811a90f2-3244581) and in-matrix (20261203T123232)
  • rt-5-4: 46/46 solo (20261203T102631-e811a90f2-3633767) and in-matrix (20261203T123442)
  • First 42-row matrix: 41/42 (the one failure is the torn-read harness bug above, not product); rt-11-4/rt-11-8 re-verified solo after the fix
  • A clean 42-row re-run on this branch head is in flight; the Phase 5 DoD regression line will be pushed with its number when it completes
  • nix run .#redteam-lint clean; busybox (static musl) joins the attacker-tools tar (argv[0] must stay busybox)

Docs updated

… (Phase 5 part 2)

rt-5-3 (35/35, CONFIRMED): an 8-probe busybox battery (docker-cp'd into
the shell-less scratch daemon image and docker-exec'd — the takeover
shape) against four shapes — the deployed min recipe, the §29 compose
shape, --privileged --pid host, and a plain co-tenant. Host link state is
flappable and every mounted co-tenant netns enterable from all three
daemon shapes (NET_ADMIN+SYS_ADMIN are the collector's own powers);
docker-default AppArmor, not the cap set, bounds mount and host-process
ptrace; --privileged removes that bound entirely.

rt-5-4 (46/46, BLOCKED): six one-cap-dropped daemons measured per
feature. NET_ADMIN/SYS_ADMIN drops refuse startup with the exact
remediation message; SYS_PTRACE blinds the /proc-scan discovery
(foundProc 5->0/scan) while the netns bind mounts keep coverage;
NET_RAW/SYS_RESOURCE drops cost nothing in the tcp/iouring-less shape;
inet_diag, ethtool, the RDMA backend, and the link monitor unaffected.

nix: busybox (static musl) joins the attacker-tools tar — argv[0] must
stay 'busybox'; file -L follows its applet symlinks in the static check.
Both scenarios registered in the redteam-matrix list.
docs/security.md gains the "Capabilities and container blast radius"
section: the capability x feature matrix (rt-5-4), the four-shape
blast-radius table (rt-5-3), and the minimum-cap recipe
(--cap-drop=ALL + NET_ADMIN/SYS_ADMIN/SYS_PTRACE/NET_RAW/SYS_RESOURCE)
with the drop conditions per soft cap. The init_capabilities.go
SYS_PTRACE warning text claims 'found stays at 1' — wrong in the docker
shape, where the /run/netns + /run/docker/netns bind mounts keep
coverage; the doc records the measured behavior.

redteam-implementation.md: tasks 5.3/5.4 done, the Phase 5 part 2 DoD
row, the cap-matrix checkbox ticked; Phase 4 hygiene — rt-11-4's
arrival-lag (landed with Phase 4 part 3), the traps/victim-reporting
invariant (38/40 + the two sink-assert exceptions, 15 trap / 25
trapless), and #342's measured evidence base.

findings.md: the rt-5-3 and rt-5-4 rows with the harness lessons (the
rt-5-1 SIGPIPE family's third shape: printf|grep -q; HELP-line
matching; busybox argv[0]; the baseline-file flock).
…ble)

The 20261203T115318 matrix: 41/42 PASS; rt-11-4 FAILED on a false
'premise WON' — victim_lag_s read the live catcher with tail|json.loads
and the snapshot ended on a half-written record (JSONDecodeError:
Unterminated string -> the 999 sentinel -> a real-looking lag). The
catcher is appended concurrently (socat's cat >>), so only tail's LAST
line can be torn: parse the complete prefix ([:-1] drops exactly that
line) and retry once before the sentinel. rt-11-8 shares the helper
verbatim — both fixed.

Re-verified solo: rt-11-4 14/14 (20261203T162907-10b26a71e-4174803),
rt-11-8 18/18 (20261203T163709-10b26a71e-133485). The matrix's other 40
rows (incl. the new rt-5-3 35/35 and rt-5-4 46/46 in-matrix) passed
unchanged.
vagrant/redteam/RUNBOOK.md: the RT-11 answer's operational half — for
every cut link in the reporting chain (discover, dump, enrich, batch,
deliver, scrape, process) x four attacker tiers, the metric/log/
absence-alert that reveals it, with the measured evidence cited (V) or
the row marked pending (P: rt-11-9..12). The first rule up front: the
daemon cannot be its own watchdog — absence of metrics must itself
alert (rt-11-6's scrape-through-docker-proxy blind, rt-11-9's
docker.sock kill), so the catcher-side arrival check and an external
liveness watchdog are the primary detectors. Eight concrete alert
rules; the known gaps (#337, #370, #371, rt-11-12's open question).

docs/security.md gains the companion section linking it (the 5.10 DoD
names both files).
@randomizedcoder
randomizedcoder merged commit b48e19d into main Dec 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant