Repository navigation
redteam: Phase 3 (part 2) — poll-frequency DoS, envelope extremes; rt-7-4 already gated - #318
Conversation
…es, govulncheck already gated rt-3-3 poll-frequency CPU DoS (CONFIRMED): SetPollFrequency to 1s/500ms + poll-burst — 3x record amplification (50/s -> 180/s; records/s track the attacker's cadence), CPU 124% -> 130%, RSS ~27MiB, no wedge (metrics 200, catcher flowing), restored + final Get. The server caps the burst interval at >= 1s (validated). rt-3-4 envelope extremes (CONFIRMED): SetEnvelopeFlush accepts the uint32 max (4 GiB / 4294967295 rows — no upper-bound validation); RSS 26.1 -> 27.2MiB over 40s (+1MiB, linear in records at this shape's rate), no instant OOM — the cap is the ceiling, the record rate is the brake, the cgroup limit is the only ceiling. Restored to the defaults (786432/10000) + final Get. rt-7-4 already covered upstream (plan row amended): checks.govulncheck exists (hermetic, pinned vuln DB — green) and govulncheck-fresh runs the live database (0 reachable findings; 1 required-module vulnerability not called by code). The plan's 'no gate today' premise was stale — no scenario written. Deferred (part 3): rt-3-2 (S3 exfil), rt-7-1/7-2/7-3 (artifact bombs) — both need the Garage fixture.
…ot CONFIRMED The full-matrix run flaked rt-3-4's growth assert (RSS 26.89 -> 26.82 — the run-1 '+1MiB' was RSS jitter, not growth). The plan row's expected column is 'no unbounded growth under admin-set extremes' — the observed stable RSS IS the defense holding: the envelope flushes on the poll cycle, so the uint32-max caps are a flush ceiling, not a growth driver. The scenario now asserts the no-growth outcome (EXPECT=BLOCKED, the growth pin kept so a flush regression flips it); findings + DoD rows amended.
|
Added the fix commit: the first full-matrix run flaked rt-3-4's growth assert — the run-1 '+1 MiB' was RSS jitter, not growth. The plan row's expected column is 'no unbounded growth under admin-set extremes', and the observed stable RSS is the defense holding (the envelope flushes on the poll cycle; the uint32-max caps are a flush ceiling, not a growth driver). rt-3-4 is now EXPECT=BLOCKED with the growth pin kept so a flush regression flips it.
|
The rt-3-3 red-team scenario measured the poll loop's amplification:
records/s track the poll cadence (50/s -> 180/s at 1 s + bursts), so a
sub-second cadence is a CPU/output amplifier an admin credential can
drive on demand. The floor bounds it.
poll_frequency now validates gte 1s in the proto — on BOTH XtcpConfig
(the startup -frequency flag and the Set/reconfigure path) and
SetPollFrequencyRequest (the RPC) — aligned with the existing
TriggerPollBurst.interval floor, so the codebase tells one story: xtcp2
honors no cadence faster than 1 second. The proto validation is the
constant; it is enforced at all three entry points:
- startup: -frequency 500ms -> exit 64 ('poll_frequency: must be
greater than or equal to 1s and less than or equal to 604800s')
- reconfigure (Set): the XtcpConfig validation rejects the change
- SetPollFrequency: InvalidArgument
The harness's own shapes stay legal (2s/1s default, the 1s/500ms
attack shape at the floor). Small-socket hosts that want fast polling
keep the full 1 s-7 days range; the proto's recommendation comment
(30 s or 60 s) stands.
Verified: TestConfigService_SetPollFrequency_floor (0 and 500 ms
rejected, the 1 s floor accepted); the full pkg/xtcp + cmd test
suites; go-vet, golangci-lint (quick + comprehensive) green. The
red-team scenario pins the fix: rt-3-3 asserts the 500 ms rejection
(the amplification bound) and the amplification at the floor — a floor
regression fails the scenario in CI. security.md's Resource
protections section documents the floor.
|
The mitigation for rt-3-3's amplification finding: The scenario now pins both sides — the 500 ms rejection (a floor regression fails CI) and the amplification at the floor (49 → 178 records/s at 1 s, healthy throughout, restored + final Non-goal (noted for a follow-up if wanted): a |
…oor value
The proto floor (poll_frequency gte 1s, enforced by protovalidate at the
startup flag, the Set/reconfigure path, and SetPollFrequency) is the
primary. This adds the Go belt at the exact moment the timer gets set,
so the invariant holds even if the rule regresses or a future caller
skips validation:
- xtcp.MinPollFrequency (pkg/xtcp/poller.go) — 1 s, the fastest poll
cadence the poller honors.
- computePollInterval clamps EVERY tick interval to the floor — the
single choke point both timer-set sites share. That also covers three
edges the proto rule cannot reach: the 0/negative durations that used
to PANIC ticker.Reset (the old test comment: 'the production poller
doesn't validate the duration either' — a daemon crash, now a slow
tick), a sub-second change-channel value (silently accepted before),
and a 100% poll_jitter_pct draw (which halves the interval to 500 ms
at a 1 s frequency — the effective cadence could sit under the floor).
- handleChangePollFrequency floors explicitly BEFORE the Reset and
counts the clamp (xtcp_counts{function=Poller,variable=ticker.Floored})
so a sub-floor write is visible in metrics, not just silently clamped.
Tests: TestHandleChangePollFrequency_floor (the 5 ms clamp -> Floored +
Reset counters; the floor value itself is not a sub-floor), the
panic-codifying table rows flip to floor-codifying (0/negative/1 ns all
reset at the floor, no panic), TestComputePollInterval gains the freq==0
-> floor and the 100%-jitter-halves-1s -> floor rows, and
TestComputePollInterval_floorRealJitter pins 2000 real jitter draws on a
floor-value frequency at >= 1 s. Full pkg/xtcp suite green; go-vet +
golangci-lint-quick green.
|
Both questions answered in code (two new commits): 1. Do we definitely call
2. The Go-side belt at the timer — yes, and it caught three real holes. The existing test literally documented the gap: "the production poller doesn't validate the duration either" —
Tests: the panic-codifying rows flip to floor-codifying (0/1 ns/5 ms/negative all reset at the floor, no panic), a dedicated |
What
Phase 3 part 2 of docs/redteam-plan.md: the admin-abuse rows that need no new fixtures (part 1 = #317; part 3 = the Garage rows, deferred).
Scenarios (findings.md rows, evidence in every run)
SetPollFrequencyto 1s/500ms +poll-burst(60 polls, 1 s apart — the server validates the interval ≥ 1 s): record rate 50/s → 180/s (3× amplification — records/s track the attacker's cadence), CPU 124% → 130%, RSS ~27 MiB, no wedge (metrics 200, catcher flowing). Amplification is bounded by the poll rate at this shape — a fleet host's namespace/socket load multiplies it. Restored + finalGet.SetEnvelopeFlushaccepts the uint32 max (4 GiB / 4294967295 rows — no upper-bound validation); RSS 26.1 → 27.2 MiB over 40 s (+1 MiB, linear in records at this shape's rate), no instant OOM — the cap is the ceiling, the record rate is the brake, the cgroup limit is the only ceiling. Restored to the defaults (786432/10000) + finalGet.checks.govulncheckexists in the flake (hermetic, pinned vuln DB — green) andgovulncheck-freshruns the live database (0 reachable findings; 1 required-module vulnerability not called by code). The plan's 'no govulncheck gate today' premise was stale — no scenario written.Remaining in Phase 3 (part 3)
rt-3-2 (S3 exfil — needs the Garage fixture), rt-7-1/7-2/7-3 (artifact bombs — Garage).