Repository navigation
Description
Severity: HIGH — from the 2026-06 suite audit. Chosen fix: switch to IAM auth (no identity-doc / no cert).
The vulnerability (confirmed)
lambda/dns-updater/main.go: signature verification is non-fatal (logs "skipped … continuing" on failure), and the only other gate validateInstance returns ALLOW whenever DescribeInstances errors (which it always does cross-account — the Route53 zone is in the infra account by design). FQDN/record/IP come from attacker-controllable request fields. Net: an unauthenticated caller can UPSERT/DELETE arbitrary A-records.
Why we are NOT fixing this with the identity-document / PKCS#7 path
Investigated thoroughly (live, against a real instance):
- The IMDS PKCS#7 / rsa2048 envelope contains zero embedded certs (verified by decoding a real envelope) — so verification requires embedding AWS's public cert.
- AWS uses a distinct, self-signed RSA-2048 cert per region (~35 of them), published only in JS-rendered docs (no machine-readable URL; probed several, all 404/400). Self-signed ⇒ spored can't just "pass the cert along" (an attacker passes their own self-signed cert and it verifies).
- spawn's currently-embedded certs are corrupt (won't parse) — verification has never actually worked; the endpoint has relied entirely on the skip-and-allow hole.
- AWS just relocated/removed the
verify-pkcs7.htmldoc page, demonstrating the cert-maintenance fragility (this is the recurring [audit] Dup: formatDuration and formatDurationForTTL are byte-identical — collapse to one #294 problem).
So the PKCS#7 path means hand-maintaining ~35 self-signed certs AWS rotates — rejected.
The fix: AWS_IAM auth on the DNS Lambda Function URL
The DNS updater is a Lambda Function URL (…lambda-url.us-east-1.on.aws), and the same infra already uses AuthType: AWS_IAM for the spore-bot admin API — so this is an established pattern, not a novel one.
Server (infra account, where the deploy lives — NOT this repo):
- Set the DNS Function URL
AuthType: AWS_IAM. - Grant the spored instance role (in each spawn launch account)
lambda:InvokeFunctionUrlon the DNS function (cross-account resource policy + the role's own grant). - Lambda reads the verified caller account/role ARN from the request's IAM/SigV4 identity (
requestContext.authorizer.iam/ signed principal) instead of parsing the identity document.
Client (pkg/dns/client.go, this repo):
4. SigV4-sign the POST with the instance role creds (aws-sdk-go-v2 signer) instead of a plain http.NewRequestWithContext.
Lambda (lambda/dns-updater/main.go):
5. Derive the FQDN's account subdomain from the verified caller account (not req.InstanceIdentityDocument/req.IPAddress).
6. Delete: identity-document parsing, verifyInstanceIdentitySignature, signature.go's embedded certs, and the cross-account default-allow in validateInstance.
Result: no identity document, no signature, no embedded cert, nothing to rotate (#294 closed for good), and stronger containment — only principals we explicitly grant can call at all, vs. "any valid EC2 doc".
Why this must be a COORDINATED client+infra change (not shippable from spawn repo alone)
If the client starts SigV4-signing but the Function URL AuthType flip + cross-account InvokeFunctionUrl grant aren't deployed in lockstep, all DNS registration breaks in prod. The deploy that owns the DNS Lambda + Function URL is in infra outside this repo. So execution order:
- Infra PR: cross-account
InvokeFunctionUrlgrant to spored roles (additive, safe to land first). - Client PR (this repo): SigV4 signing, behind the existing endpoint config.
- Infra: flip
AuthTypetoAWS_IAM+ deploy the Lambda handler change — in lockstep with (2) rolling out. - Remove the legacy identity-doc/cert code.
Interim
Not making verification fatal alone (the embedded certs are corrupt + the caller re-marshals the doc, so it would break ALL registration). The hole stays open only as long as the IAM cutover is pending; prioritize the infra grant + cutover. Live test plan: a throwaway instance SigV4-calls the IAM-auth Function URL and registers a record; verify an unsigned call now gets 403.
Priority
P0. Cross-repo (spawn client + infra). Companion HIGH #174 (CreateTags scoping) is independent and shipping separately.
Activity
scttfrdmn commentedon Jun 24, 2026
Infra prerequisite found
Checked the spore-host umbrella: the dns-updater Lambda + Function URL are NOT under infrastructure-as-code.
infra/tofu/contains onlyspore-bot/main.tf(and that Function URL isauthorization_type = "NONE"). The DNS Lambda (zqonqra6…lambda-url.us-east-1.on.aws) was deployed out-of-band (console/manual), so there's no IaC to PR theAuthType: AWS_IAMflip + cross-accountInvokeFunctionUrlgrant against today.So the IAM-auth cutover gains a step 0: bring the dns-updater under tofu in
spore-host/infra/tofu/dns-updater/(Lambda, Function URL, Route53 perms, env:DOMAIN_ZONES/DEFAULT_DOMAIN), importing the existing function so the live endpoint URL is preserved. Then the cutover (cross-account grant → client SigV4 → flip AuthType → remove legacy cert code) proceeds as described above. Theaws_lambda_function_urlresource inspore-bot/main.tfis the template for the Function-URL + permission wiring.Revised execution order:
0. infra (spore-host): codify the dns-updater in tofu (import existing fn → no endpoint change).
lambda:InvokeFunctionUrlgrant for spored roles (additive).authorization_type = "AWS_IAM"+ deploy the IAM-aware Lambda handler, in lockstep with (2).signature.go/ cross-account default-allow.feat: opt-in SigV4 signing for DNS registration (#173 client half) (#242
scttfrdmn commentedon Jun 25, 2026
Step 2 (client SigV4 signing) merged — #242
pkg/dns/client.gonow SigV4-signs the DNS Function URL POST with the instance role's ambient credentials (servicelambda, the Function URL region), gated behindSPORE_DNS_SIGV4(off by default). A signed request against the currentAuthType: NONEURL is accepted unchanged, so this is non-breaking and can roll out to instances ahead of the flip. Ships in the next spawn release.Cutover status
lambda:InvokeFunctionUrlgrant to spored roles (additive)SPORE_DNS_SIGV4)AuthType: AWS_IAM+ deploy IAM-aware handler — in lockstep with turningSPORE_DNS_SIGV4on (the bootstrap should set it once the flip lands)signature.go/ embedded certs / cross-account default-allow inlambda/dns-updater/main.goSteps 0/1/3 are prod deploys in the infra account and the destructive
AuthTypeflip — those are operator-driven, not auto-shippable from this repo. The vulnerability stays open until step 3 lands; prioritize the infra grant + cutover. Step 4 then removes the dead legacy code.feat: field DNS request signing + spored self-grant for IAM-auth cuto…
feat: IAM-aware dns-updater handler with verified-account namespacing (…
scttfrdmn commentedon Jun 25, 2026
Cutover redesigned + code/IaC landed; only the gated prod flip remains
After review, dropped the account-enumeration approach for the cross-account grant — it doesn't scale (spawn launches in unbounded accounts with dynamically-named spored roles, and the Lambda resource policy has a ~20KB ceiling). New model needs zero allow-list upkeep:
Principal: "*"underAuthType: AWS_IAM= "any SigV4 signer", not anonymous.lambda:InvokeFunctionUrl(per-account, no infra enrollment).base36(its-verified-accountID).<domain>. Cross-account spoofing closed cryptographically; no per-region certs ([audit] Dup: formatDuration and formatDurationForTTL are byte-identical — collapse to one #294 closed for good).Status
x/netCVE.)lambda:InvokeFunctionUrlon the dns fn. PR feat: field DNS request signing + spored self-grant for IAM-auth cutover (#173) #243 ✅ merged.SPORE_DNS_SIGV4). PR feat: opt-in SigV4 signing for DNS registration (#173 client half) #242 ✅ merged.SPORE_DNS_SIGV4=1→ fielded fleet signs. PR feat: field DNS request signing + spored self-grant for IAM-auth cutover (#173) #243 ✅ merged.scripts/deploy-custom-dns.sh) and flip the Function URL (enable_iam_invoke=true+authorization_type=AWS_IAMin the tofu module,tofu apply). Verify a signed call registers and an unsigned call 403s.signature.go/ identity-doc parsing / embedded certs / cross-account default-allow.The vulnerability stays open until 3b. 3b is the only destructive, prod-breaking step and is deliberately operator-gated: it must wait for a signing fleet (enabler shipped in a release + instances cycled), and the handler-deploy + AuthType-flip must happen together.
scttfrdmn commentedon Jun 25, 2026
Safe prep done — release shipped + dual-path handler deployed; only the flip remains
Step 3a (release): spawn v0.67.0 released — ships the enabler (
SPORE_DNS_SIGV4=1in spored's systemd unit), the spored self-grant (lambda:InvokeFunctionUrl), and the IAM-aware handler. spored binaries for 0.67.0 are live in S3 (verified, fresh upload), so any instance launched from v0.67.0+ now signs its DNS requests. Old instances age out under their TTLs.Step 3b-code (handler deploy): the dual-path handler is deployed to the live
spawn-dns-updater(update-function-code, code-only — same role/env/URL, AuthType still NONE). Verified live:LastUpdateStatus: Successful"missing identity document/signature (and no AWS_IAM authorizer present)"), proving the dual-path logic is live; a real legacy request still takes the legacy path and succeeds → non-breaking.Did NOT run the full
scripts/deploy-custom-dns.sh— it would create a stray API Gateway + a duplicate IAM role (SpawnDNSLambdaRole≠ the live tofu-managedSpawnDNSLambdaExecutionRole) and also has a build bug (go build main.gomissessignature.go→undefined: verifyInstanceIdentitySignature). Used a surgicalupdate-function-codeinstead.Remaining
enable_iam_invoke=true+authorization_type=AWS_IAM,tofu apply) — gated until a signing fleet has cycled in (v0.67.0+ instances) and old non-signing instances have aged out. Then verify a signed call registers + an unsigned call 403s at the auth layer.signature.go/ identity-doc parsing / certs / cross-account default-allow.Note: the
deploy-custom-dns.shgo build main.gobug should be fixed togo build .(separate small PR).chore: remove legacy identity-doc auth from dns-updater (#173 step 4) (…
feat: DCV handshake retry + bounded idle grace + IAM/SG reconcile (sp…
chore(release): v0.69.0
fix(dns): surface DNS registration failures instead of swallowing them (
Remove the DNS updater's unauthenticated API Gateway, and gate it (#870…
Sign DNS requests by default, for the endpoint's region (#883)
Sign DNS requests by default, for the endpoint's region (#883) (#889)