Skip to content

Implement spore.host authenticity key: signed spore tag that all spore tools verify before touching an instance #76

Open

Description

@scttfrdmn

Goal

Establish a spore.host-owned signing key and a signed authenticity tag
on every spore, so spore tools can cryptographically verify an instance is a
legitimate spore.host spore. Invariant: if the signature is absent or does not
verify, spore tools will not touch the instance
— they treat it as not-ours.

This is the trust root for all destructive/mutating spore automation, motivated
by the TTL reaper (#70): today the reaper acts purely on plaintext tags
(spawn:managed=true + past spawn:ttl-deadline), which anyone with
ec2:CreateTags can forge to either trick the reaper into killing a non-spawn
instance, or to hide a spore from it. A signature anchored to a key only
spore.host holds removes tag forgery as an attack.

Key ownership

  • The signing key belongs to spore.host, in its infra account (966362334030).
  • Asymmetric (sign/verify), preferably KMS asymmetric (ECC_NIST_P256 / sign)
    so the private key never leaves KMS:
    • Private key: only the launch path / spawn extend may call kms:Sign
      (scoped IAM in infra).
    • Public key: distributed to verifiers (the reaper Lambda, and any other
      spore tool); verification is offline, no KMS call needed.
  • Cross-account: spores run in many accounts, but they're all signed by the one
    infra-account key; verifiers just need the public key.

The signed tag

  • spawn:ttl-sig (or spawn:sig) = signature over a canonical payload binding
    at minimum instance-id + account-id + ttl-deadline (so a signature can't
    be replayed onto another instance, and a deadline can't be extended without
    re-signing — spawn extend must re-sign).
  • Written at launch alongside the existing spawn:* tags.

Verification contract (shared primitive)

A single verify function (e.g. pkg/authenticity) used by every spore tool
that mutates or terminates an instance:

Verified(instance) == valid signature over (instance-id, account, deadline)
                      using the spore.host public key

Design decisions to resolve

  • Migration: existing unsigned instances. Per the invariant, tools won't
    touch them — which is safe for destructive actions but means the reaper
    won't reap legacy spores (potential leak). Options: backfill-sign the current
    fleet via the launch role, a cutover date, or a documented max-age sweep for
    the legacy unsigned set. MUST be decided before enforce mode relies on
    signatures.
  • Sig-stripping: an attacker who deletes spawn:ttl-sig makes a spore
    unverifiable → untouchable → leaks. Mitigate by restricting ec2:CreateTags/
    DeleteTags on the spawn:* namespace to the launch role via IAM/SCP, so the
    authenticity tags can't be forged or stripped in the first place (highest
    leverage; pairs with signing).
  • Payload canonicalization + versioning (spawn:sig-v), key rotation, and the
    KMS key policy.

Scope / sequencing

Related: #70, #72, #75.

Activity

  1. changed the title [-]Harden reaper against tag forgery: signed spawn:ttl-deadline tags[/-] [+]Implement spore.host authenticity key: signed spore tag that all spore tools verify before touching an instance[/+] on Jun 8, 2026
  2. added
    area:infra
    on Jun 12, 2026
  3. scttfrdmn commented on Oct 11, 2026

    @scttfrdmn
    ContributorAuthor

    Audit note — this issue is the designed fix for a threat the 2026-10 review
    re-confirmed, and its framing is already exactly right:

    today the reaper acts purely on plaintext tags (spawn:managed=true + past
    spawn:ttl-deadline), which anyone with ec2:CreateTags can forge

    Three specifics worth adding, because they narrow who "anyone" is and because one
    of them is independently fixable without waiting for the signing key.

    1. The forger does not need stolen credentials — the instance's own role suffices

    pkg/aws/iam.go:921-933 (and the DCV copy at :1296-1305) grants the instance
    ec2:CreateTags/ec2:DeleteTags conditioned on
    ec2:ResourceTag/spawn:managed=true — a condition its own instance satisfies.
    The #174 fix correctly stopped a spore tagging foreign instances; it does not
    stop a spore rewriting its own control tags. So any code execution on a spore —
    the owner's own job, or an RCE in their workload — is enough.

    2. The max-age ceiling is skipped on the forged branch, and that part is fixable now

    lambda/ttl-reaper/main.go:744-760:

    if dl := tags[tagprefix.Tag("ttl-deadline")]; dl != "" {
        if deadline, err := time.Parse(time.RFC3339, dl); err == nil {
            if now.After(deadline) { ... return c, true }
            // Within deadline — respect it; do NOT also apply max-age below
            return candidate{}, false
        }

    A deadline of 2099 therefore exempts the instance from the max-age ceiling as
    well
    , which template.yaml:41 advertises as a "hard max-age ceiling". Removing
    that early return makes the ceiling genuinely unconditional and bounds the
    damage to MaxAge instead of forever — one line, no dependency on this issue.

    3. The detection control is defeated by the same primitive

    SporedQuietAlarm (lambda/ttl-reaper/template.yaml:539) fires on the
    SPORED NOT CHECKING IN sentinel, which heartbeat.go:61 derives from the
    spawn:last-heartbeat tag — written by the in-instance agent at
    pkg/agent/agent.go:711. So an instance can forge its own liveness attestation:
    kill spored, extend the deadline, and no alarm fires.

    heartbeat.go:85-88 states the assumption this breaks: "the instance's lifetime
    is still governed by spawn:ttl-deadline and the reaper's max-age ceiling, which
    are the right authorities."
    Both are instance-writable, so neither is an
    authority today.

    Why no separate advisory

    The threat is already public here, so filing it privately would be theatre. The
    cheap mitigations — the unconditional ceiling above, and denying the control tag
    keys on the instance role via ForAllValues:StringNotEquals on aws:TagKeys —
    belong in this issue or a small PR referencing it.

    Interaction to watch: #112 proposes making the tag prefix configurable
    (prism:/prp:), which a tag-key denylist would have to track. And #38/#39 ask
    to widen spored-instance-role; those should not be merged without checking
    they do not re-grant unconditioned tag writes.

  4. added this to the Later milestone on Oct 19, 2026
  5. modified the milestones: Later, Post-1.0 on Nov 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:infra

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions