Repository navigation
Description
Security issue. Detail is in private advisory GHSA-8q3p-qcv8-2pr4 rather than here;
this issue tracks the remediation only.
The reaper's graceful pre-stop tier runs an instance tag's contents through SSM
AWS-RunShellScript, which executes as root, and the spored instance role can write
that tag on any spawn:managed instance in the account. Found while verifying the
su -c username splice from the audit, which turns out to be the smaller half of it.
Three parts, in dependency order:
-
lambda/ttl-reaper/main.go:1036— validatec.localUsernamewith
security.ValidateUsernamebefore interpolating it, and build the command in argv
form instead of asu -cstring. The module does not importpkg/securityat
all today; itsgo.modalready requiresgithub.com/spore-host/spawn, so this
costs nothing.pkg/launcher/bootstrap.go:172andpkg/agent/sys_linux.go:244
are the two correct siblings to match. -
lambda/ttl-reaper/main.go:1021-1038— decide what the hook runs as when
spawn:local-usernameis absent. Today it runs as root, which contradicts
--pre-stop runs as root, should run as the instance user #63 ("run the hook as this user"). Skipping the hook is the fail-closed choice;
the reaper terminates regardless, so the hard-deadline guarantee (Guardrail: TTL must always terminate — never add a TTL→stop mode #72) is
unaffected either way. -
pkg/aws/iam.go:921-933and the DCV copy at:1296-1305— deny the reaper's
control tag keys to the instance role (spawn:ttl-deadline,
spawn:last-heartbeat,spawn:pre-stop,spawn:local-username) with
ForAllValues:StringNotEqualsonaws:TagKeys. The existing comment reasons
that thespawn:managedcondition means a spore "cannot pull a foreign instance
into scope" — true, but re-tagging an instance already in scope is the attack.
Same surface as the deadline-tampering half of Implement spore.host authenticity key: signed spore tag that all spore tools verify before touching an instance #76.
Gates to go with it: the username path needs a test that drives a hostile tag value
(rule 2 — construct the state, don't reach it through the happy path), and the tag-key
denial needs simulate-principal-policy showing the control keys denied and an
ordinary spawn:-prefixed tag still allowed, since aws:TagKeys with
ForAllValues is easy to write in a way that denies every tag write including
spored's own.
Not a latent-only finding: the cross-account reaper role in 435415984226 holds a
working SendCommand, so the path is live there. The production role in 966362334030
has no SendCommand grant at all, which blocks it there by accident rather than by
design — see #818.
Activity
scttfrdmn commentedon Oct 11, 2026
Two corrections and one addition from verifying the live state, before any code lands.
1. Not exploitable in production today, contrary to what I wrote on this issue.
I said "the cross-account reaper role in 435415984226 holds a working
SendCommand, sothe path is live there." The grant is there; the code path is not reached.
spawn-ttl-reaper-productionsets no
REAPER_GRACEFUL, andtryGracefulPreStopis called only underif r.graceful(
main.go:614), so the whole graceful tier is dead code in the deployed function. Itarms the moment #187 is enabled as documented — a one-env-var change — so this is latent,
not closed. Checking a grant without checking the invocation is the same mistake I made on
#818 in the other direction.
2. Two of the four tag keys I listed cannot be denied. spored writes
spawn:last-heartbeatitself every cycle (pkg/agent/agent.go:711) and both writes anddeletes
spawn:ttl-deadlineon thespored ttl setpath (cmd/spored/main.go:1090-1096,via
ttl.SetTags). Denying those would break idle detection andspored ttlwhilereading as a hardening. The deny list is therefore three keys —
spawn:pre-stop,spawn:pre-stop-timeout,spawn:local-username— all of which are set once at launch bythe CLI and have no in-instance writer. Deadline tampering stays contained by the
unconditional max-age ceiling (#76) instead, which is the right tool precisely because
that key has a legitimate writer. There is now a gate that fails if a denied key gains an
in-instance writer; it catches this exact mistake.
3. The IAM half does need remediation, unlike #818.
spored-instance-rolein435415984226 carries the vulnerable shape today:
ec2:CreateTagsconditioned only onspawn:managed=true, and zeroDenystatements. The role is rewritten on each launch, soa launch from a build containing the fix updates it, but a long-lived role keeps the old
grant until then.
The reaper code fix is the independent and higher-priority half: it closes the root
escalation on its own, without waiting for the policy to reach any instance. Deploying the
reaper is a live change and I have not made it.
One thing the gates found that the audit did not:
security.ValidateUsernameacceptsroot, sosu - root -c …was a no-op privilege drop. The reaper now refuses itexplicitly.