You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
security: IMDSv2 and hop limit 1 are set only in compliance mode; other launch paths leave IMDS at the AMI or account default #1588
From the pre-1.0 security audit (spore-host/spore-host#649, 2026-11-11), audit id instance-6. Verified: confirmed, severity low (reviewer said medium).
Where:pkg/aws/launch_settings.go:338 (at origin/main on 2026-11-11)
Evidence
if lc.IMDSv2Enforced { ... HttpTokens: types.HttpTokensStateRequired, HttpPutResponseHopLimit: aws.Int32(hopLimit) ... }. IMDSv2Enforced is set only at cmd/launch_single.go:362 inside if complianceMode != "". No MetadataOptions in lambda/sweep-orchestrator/main.go (RunInstances at 803/1671), lambda/pipeline-orchestrator/main.go:1030, lagotto (pkg/watcher/spawnconfig.go builds LaunchConfig without it), or spawn-ts src/aws/ec2.ts:240 RunInstancesCommand. Only pkg/egressproxy/deploy/create.go:181 sets it unconditionally.
Scenario
Launches from a custom --ami, an app-images BYO image, an image from spawn create-ami, Ubuntu, or older Windows AMIs, with no account-level IMDS default, accept IMDSv1 and hop limit 1-2. An SSRF in a public web app (443 is world-open) or in user workloads then yields the spored role credentials without a PUT token. Combined with the account-wide Terminate/DescribeTags grants above, that is account-wide impact. With hop limit 2, containers run by spawn task and web apps can reach IMDS as well.
Verifier
spawn/pkg/aws/launch_settings.go:338-349 sets MetadataOptions only when lc.IMDSv2Enforced is true. That flag is set only in the compliance path (cmd/launch_single.go:362, pkg/compliance/nist80171.go:57). Only pkg/egressproxy/deploy/create.go:181 sets the option unconditionally. Downgraded to low: the default AMI is AL2023 (pkg/aws/ami.go:24), whose ImdsSupport=v2.0 already requires tokens. Exposure is limited to custom, Ubuntu or older AMIs, and an SSRF in the workload is still needed.
Suggested fix
Set MetadataOptions{HttpTokens: required, HttpEndpoint: enabled, HttpPutResponseHopLimit: 1, or 2 only when the launch runs containers that need it} unconditionally in the shared RunInstances builder. Mirror it in the sweep and pipeline Lambdas and spawn-ts. Add a parity test like the existing tag-contract tests.
Deployed-state check
Run aws ec2 get-instance-metadata-defaults in the launch accounts, and check MetadataOptions.HttpTokens on a live sweep member and a lagotto-launched instance. Check ImdsSupport on AMIs produced by spawn create-ami.
Activity
Regenerate the CLI reference for --imds-hop-limit (#1588)
Require IMDSv2 on every launch path (#1588)
Regenerate the CLI reference for --imds-hop-limit (#1588)
Require IMDSv2 on every launch path (#1588) (#1613)