AWS public exposure: snapshots, AMIs, URLs
Brief
Beyond buckets, an AWS account can publish disk snapshots, machine images, database snapshots, function URLs, API methods and network listeners to the whole internet, each through its own setting. The review reads every one of those settings from inside the account, then confirms the worst exposure from an account we own by reading metadata only, with nothing copied, restored or invoked.
On this page
- Situation
- A read-only review role (
ReadOnlyAccessorSecurityAudit) in each account the scope letter names, and for the outside check a separate AWS account the firm owns with no relation to the client. Every command describes a setting or a resource; nothing is shared, unshared, copied, restored, invoked or started, and the outside check reads one snapshot's or image's metadata. Only the accounts and regions in the letter are read, region by region. - Goal
- A list of every resource the account exposes to anyone, by type, region and id, each with the setting that exposes it and the account-level block that would have stopped it.
- Outputs
- Representative examples on placeholder hosts, trimmed to the lines that matter. Not captured from a public fixture yet.
Check first
- The regions in scope from the scoping page. Snapshot, image and listener settings are regional, so every step loops over them.
- Whether IAM Access Analyzer has an analyzer in each region, so its public findings can be set beside ours.
- Which endpoints the client means to be public: a marketing site, a public API, a status page. Those are listed as intended, not reported.
- The outside account we use for confirmation, its id written in the operator log before the first call.
- Whether the cloud first hour already recorded the S3 account block; this page extends that one-line check to every region and resource type.
Steps
AWS
Are the account-level public access blocks on in every region?
aws s3control get-public-access-block --account-id 111122223333
for r in us-east-1 eu-west-1; do
printf '%s\t%s\t%s\n' "$r" \
"$(aws ec2 get-snapshot-block-public-access-state --region "$r" --query State --output text)" \
"$(aws ec2 get-image-block-public-access-state --region "$r" --query ImageBlockPublicAccessState --output text)"
done
Expected output
$ aws s3control get-public-access-block --account-id 111122223333
{
"PublicAccessBlockConfiguration": {
"BlockPublicAcls": true,
"IgnorePublicAcls": true,
"BlockPublicPolicy": true,
"RestrictPublicBuckets": true
}
}
$ for r in us-east-1 eu-west-1; do ... done
us-east-1 unblocked unblocked # <- snapshots and images in this region can still be made public
eu-west-1 block-all-sharing block-new-sharing
Three separate switches cover three resource types. The S3 block is account-wide; the snapshot and image blocks are per region. For snapshots, block-all-sharing also stops existing public snapshots from being public, while block-new-sharing leaves them public and only refuses new ones. The image block has one setting, which refuses new public sharing and leaves images already public as they are. An unblocked region is not a finding by itself; it is where the next step looks first.
Negative result. All four S3 settings true, block-all-sharing for snapshots and block-new-sharing for images in every region in scope.
Fix. Turn on all four S3 settings at the account, snapshot blocking at block-all-sharing and image blocking in every region, and set them from the organization with declarative policies where the client uses them, so new accounts start blocked.
Which snapshots and machine images are shared with everyone?
aws ec2 describe-snapshots --region us-east-1 --owner-ids self --restorable-by-user-ids all \
--query 'Snapshots[].[SnapshotId,VolumeSize,StartTime,Description]' --output text
aws ec2 describe-images --region us-east-1 --owners self --filters Name=is-public,Values=true \
--query 'Images[].[ImageId,Name,CreationDate]' --output text
for s in $(aws rds describe-db-snapshots --region us-east-1 --snapshot-type manual \
--query 'DBSnapshots[].DBSnapshotIdentifier' --output text); do
printf '%s\t%s\n' "$s" "$(aws rds describe-db-snapshot-attributes --region us-east-1 --db-snapshot-identifier "$s" \
--query "DBSnapshotAttributesResult.DBSnapshotAttributes[?AttributeName=='restore'].AttributeValues[]" --output text)"
done
Expected output
$ aws ec2 describe-snapshots ... --restorable-by-user-ids all ...
snap-0a1b2c3d4e5f60718 100 2025-03-14T09:22:51+00:00 prod-api root volume before patching # <- a production disk anyone can restore
$ aws ec2 describe-images ... Name=is-public,Values=true ...
ami-0123456789abcdef0 api-golden-2025-02 2025-02-27T16:40:03.000Z
$ for s in ...; do ... done
orders-pre-migration all # <- a database snapshot any AWS account can restore
billing-weekly 444455556666
--restorable-by-user-ids all returns the snapshots whose create-volume permission includes everyone, and is-public does the same for images. A public snapshot is a full disk: whoever restores it reads every file on it, which is why the description and size matter more than the id. A database snapshot is public when its restore attribute holds all; a named account id there is a grant to that account, which belongs on the resource policy review. Encrypted snapshots cannot be made public, so a public one was never encrypted. The loop prints names and attribute values only; Aurora keeps cluster snapshots instead, read the same way with describe-db-cluster-snapshots and describe-db-cluster-snapshot-attributes.
Negative result. No public snapshots, images or database snapshots in any region in scope.
Fix. Remove the public permission (aws ec2 modify-snapshot-attribute --snapshot-id snap-0a1b2c3d4e5f60718 --attribute createVolumePermission --operation-type remove --group-names all for the snapshot above), treat whatever was on the disk as exposed from its share date, and encrypt snapshots by default with aws ec2 enable-ebs-encryption-by-default in every region.
Which functions and APIs answer without AWS credentials?
for f in $(aws lambda list-functions --region us-east-1 --query 'Functions[].FunctionName' --output text); do
aws lambda list-function-url-configs --region us-east-1 --function-name "$f" \
--query "FunctionUrlConfigs[?AuthType=='NONE'].[FunctionArn,FunctionUrl]" --output text
done
for a in $(aws apigateway get-rest-apis --region us-east-1 --query 'items[].id' --output text); do
aws apigateway get-resources --region us-east-1 --rest-api-id "$a" --embed methods \
--query "items[].{path:path,methods:resourceMethods.*.[httpMethod,authorizationType,apiKeyRequired]}" --output json \
| jq -r --arg a "$a" '.[] | select(.methods) | .path as $p | .methods[] | select(.[1] == "NONE") | [$a, $p, .[0], (.[2] | tostring)] | @tsv'
done
Expected output
$ for f in ...; do aws lambda list-function-url-configs ... done
arn:aws:lambda:us-east-1:111122223333:function:orders-sync https://<url-id>.lambda-url.us-east-1.on.aws/ # <- callable by anyone with the URL
$ for a in ...; do aws apigateway get-resources ... done
a1b2c3d4e5 /health GET false
a1b2c3d4e5 /v1/export POST false # <- no authorizer and no key on a write route
A function URL with AuthType NONE skips AWS authentication, and the function's resource policy then decides who may call it: the console adds a statement allowing everyone when it creates such a URL, the CLI and infrastructure code add one with add-permission, and aws lambda get-policy shows which is there. On API Gateway REST APIs each method has its own authorizationType, and NONE with no API key means the method is public unless the API's resource policy limits source addresses. HTTP APIs list routes with aws apigatewayv2 get-routes --api-id <api-id> --query 'Items[].[RouteKey,AuthorizationType]'. We list what is open and never call a function URL or a write route; a health check that is meant to be public goes in the intended list.
Negative result. Every function URL uses AWS_IAM, and every method outside the client's intended public list has an authorizer, IAM authorization or a resource policy.
Fix. Use AWS_IAM on function URLs unless the function is a public endpoint by design, put an authorizer on every API route that reads or writes data, and deny lambda:CreateFunctionUrlConfig with NONE through an SCP on lambda:FunctionUrlAuthType.
What listens on the internet?
aws elbv2 describe-load-balancers --region us-east-1 \
--query "LoadBalancers[?Scheme=='internet-facing'].[LoadBalancerName,Type,DNSName]" --output text
aws rds describe-db-instances --region us-east-1 \
--query 'DBInstances[?PubliclyAccessible].[DBInstanceIdentifier,Engine,Endpoint.Port]' --output text
aws ec2 describe-security-groups --region us-east-1 --filters Name=ip-permission.cidr,Values=0.0.0.0/0 \
--query "SecurityGroups[].[GroupId,GroupName,join(',', IpPermissions[?IpRanges[?CidrIp=='0.0.0.0/0']].to_string(FromPort))]" --output text
aws ec2 describe-instances --region us-east-1 --filters Name=instance-state-name,Values=running \
--query "Reservations[].Instances[?PublicIpAddress].[InstanceId,PublicIpAddress,join(',', SecurityGroups[].GroupId)]" --output text
Expected output
$ aws elbv2 describe-load-balancers ...
web-public application web-public-1234567890.us-east-1.elb.amazonaws.com
$ aws rds describe-db-instances ...
orders-replica postgres 5432 # <- a database with a public address
$ aws ec2 describe-security-groups ... Name=ip-permission.cidr,Values=0.0.0.0/0 ...
sg-0aa11bb22cc33dd44 web-public-sg 443
sg-0ee55ff66aa77bb88 orders-db-sg 5432 # <- open to the internet on the database port
$ aws ec2 describe-instances ...
i-0abc1234def567890 198.51.100.40 sg-0aa11bb22cc33dd44
Exposure on the network is a chain: a public address, a security group that admits the internet on a port, and something listening. PubliclyAccessible on a database means it has a public address; with orders-db-sg open on 5432 the chain is complete. Security groups are filtered on IPv4 here; Name=ip-permission.ipv6-cidr,Values=::/0 is the IPv6 twin and must be run too. FromPort is the start of a range, so a group that opens a range shows its first port only, and its full rule is read with aws ec2 describe-security-group-rules --filters Name=group-id,Values=<group-id>. We do not scan these addresses; the configuration is the finding, and any reachability test belongs to an external test with its own letter.
Negative result. Internet-facing load balancers only for the client's intended public services, no public databases, and no security group open to 0.0.0.0/0 or ::/0 on anything but 80 and 443 in front of a load balancer.
Fix. Turn off PubliclyAccessible on databases, put instances behind load balancers in private subnets, and close administrative and database ports to the internet in every security group, with AWS Config's restricted-ssh and rds-instance-public-access-check rules to keep them closed.
How do I confirm an exposure from outside without copying anything?
aws ec2 describe-snapshots --profile atarus-outside --region us-east-1 --snapshot-ids snap-0a1b2c3d4e5f60718 \
--query 'Snapshots[].[SnapshotId,OwnerId,VolumeSize,Encrypted]' --output text
aws ec2 describe-images --profile atarus-outside --region us-east-1 --image-ids ami-0123456789abcdef0 \
--query 'Images[].[ImageId,OwnerId,Public]' --output text
Expected output
snap-0a1b2c3d4e5f60718 111122223333 100 False # <- visible to an account with no relation to the client
ami-0123456789abcdef0 111122223333 True
The outside account has no grant from the client, so seeing the snapshot proves it is public to every AWS account. That is the whole proof: we never restore the snapshot, copy it, launch the image or read a byte of its data, and the written impact says what a restore would give an attacker in the client's own terms, from the description and size. The outside profile is the firm's own account and is named in the letter.
Negative result. InvalidSnapshot.NotFound from the outside account for a snapshot the review listed as public: it was unshared between the two reads, and the report says when.
Fix. After removing the public permission, rerun the outside read; InvalidSnapshot.NotFound is the retest result that closes the finding.
The defender sees
Every inside read is a management event in the client's CloudTrail under the review session: GetSnapshotBlockPublicAccessState, GetImageBlockPublicAccessState, DescribeSnapshots, DescribeImages, DescribeDBSnapshots, DescribeDBSnapshotAttributes, GetRestApis, GetResources, DescribeLoadBalancers, DescribeDBInstances, DescribeSecurityGroups and DescribeInstances, with Lambda's reads carrying the API version in the event name, such as ListFunctions20150331, and the S3 account block read under the S3 Control service. The outside confirmation is recorded in the firm's account, not the client's, and that is the point to make in the report: anyone in the world can make the same read and the client has no log of it. What the client can see is the change that made each resource public, ModifySnapshotAttribute, ModifyImageAttribute, ModifyDBSnapshotAttribute or the event that created the function URL, with its date, which is the start of the exposure window in the finding. Access Analyzer raises public findings for snapshots and database snapshots in accounts where an analyzer is on.
Done when
The S3, snapshot and image public access blocks are recorded for every region in scope, every public snapshot, image and database snapshot is listed, every function URL and API method without AWS authentication is named, internet listeners are listed with their open ports, and the worst exposure is confirmed from outside.
Not covered
Anonymous bucket checks (see public bucket checks), grants to named outside accounts (see the resource policy review), what a public endpoint does once reached, and any port scanning; the outputs shown are representative examples on placeholder accounts, not captured runs.