Onam
CSPM

Which five AWS misconfigurations should we check first? Commands and fixes

By Anup Yadav, Founder & CEO•July 10, 2026•Updated November 27, 2026•5 min read

Would rather we looked for you? We run a free one-time audit scan of one cloud account and go through the results with you. No charge, no commitment.

Free audit scan

Which AWS misconfigurations should we check before anything else? Five, because each one turns a small mistake into a breach: S3 buckets that are public through a policy, EC2 instances that still accept IMDSv1, RDS snapshots shared with every AWS account, security groups open to the internet on admin ports, and CloudTrail that does not cover every Region. Each check below is a read-only AWS CLI command you can run in a few minutes, with its fix.

Rewritten 27 November 2026. The earlier version listed the same five without commands or fixes. Every command below is from the AWS CLI reference, linked under each check and read on 27 November 2026. We make no claim about how often these appear; we have not published data on that.

Before you start. The checks need only read permissions such as Describe, Get and List (the AWS managed SecurityAudit policy covers them). The fixes change things, so run them through your normal change process, and in Terraform if Terraform owns the resource. EC2, RDS and CloudTrail checks are per Region: add --region <region> and repeat.

1. Is any S3 bucket public through its policy?

Blocking public ACLs is not enough; a bucket policy can still grant s3:GetObject to everyone. Check the account-level Block Public Access first, then ask S3 whether a bucket's policy makes it public:

aws s3control get-public-access-block --account-id <account-id>
aws s3api get-bucket-policy-status --bucket <bucket-name>

All four account-level settings should be true. For the bucket, "IsPublic": true is the finding.

Fix, once you have confirmed no bucket is meant to be public: turn on all four Block Public Access settings for the account (console: S3, Block Public Access settings for this account), or in Terraform for each bucket. Sources: s3control get-public-access-block, get-bucket-policy-status.

2. Can an EC2 instance still use IMDSv1?

With IMDSv1, a server-side request forgery (SSRF) bug in an application can fetch the instance role's temporary credentials. IMDSv2 requires a session token first.

aws ec2 describe-instances --filters Name=metadata-options.http-tokens,Values=optional --query "Reservations[].Instances[].InstanceId" --output text

Any instance ID printed still accepts IMDSv1.

Fix, after checking the instance makes no IMDSv1 calls (AWS's MetadataNoToken CloudWatch metric tracks them):

aws ec2 modify-instance-metadata-options --instance-id <instance-id> --http-tokens required --http-endpoint enabled

Sources: describe-instances, Modify instance metadata options for existing instances.

3. Is any RDS snapshot shared with every AWS account?

Teams share a manual snapshot to move data between environments and forget to undo it. AWS documents that if all is in the values of a snapshot's restore attribute, "the manual DB snapshot is public and can be copied or restored by all Amazon Web Services accounts".

aws rds describe-db-snapshot-attributes --db-snapshot-identifier <snapshot-id>

Fix:

aws rds modify-db-snapshot-attribute --db-snapshot-identifier <snapshot-id> --attribute-name restore --values-to-remove all

Accounts added to the attribute by ID keep their access, so review those too. Sources: describe-db-snapshot-attributes, modify-db-snapshot-attribute.

4. Is SSH, RDP or a database port open to the whole internet?

This command is adapted from an example in the AWS CLI reference. It lists security groups with a rule on port 22 and a rule open to 0.0.0.0/0. AWS notes that a group matches when any combination of its rules matches the filters, so confirm each result by reading the group's rules:

aws ec2 describe-security-groups --filters Name=ip-permission.from-port,Values=22 Name=ip-permission.to-port,Values=22 Name=ip-permission.cidr,Values='0.0.0.0/0' --query "SecurityGroups[*].[GroupId,GroupName]"

Repeat with 3389 (RDP), 3306, 5432 and the other database ports you use. Repeat with Name=ip-permission.ipv6-cidr,Values='::/0' for IPv6. Port 443 on a load balancer may be intended; admin ports rarely are.

Fix:

aws ec2 revoke-security-group-ingress --group-id <group-id> --protocol tcp --port 22 --cidr 0.0.0.0/0

For admin access, AWS Systems Manager Session Manager needs no inbound port at all. Sources: describe-security-groups, revoke-security-group-ingress.

5. Would you have a record if someone did any of the above?

aws cloudtrail describe-trails --query "trailList[].[Name,IsMultiRegionTrail,LogFileValidationEnabled,S3BucketName]" --output table

You want at least one trail with IsMultiRegionTrail and LogFileValidationEnabled both True, writing to a bucket that passes check 1.

Fix: turn an existing trail into a multi-Region trail with log file validation:

aws cloudtrail update-trail --name <trail-name> --is-multi-region-trail --enable-log-file-validation

Run it from the trail's home Region. S3 object-level (data) events are not logged unless you add them, and they are billed separately, so add them first for the buckets that hold sensitive data. Sources: describe-trails, update-trail.

Which of the five comes first?

The one that connects to others. An instance that accepts IMDSv1, is reachable on port 22 from the internet and has a broad instance role is one path, not three findings. Fix the link that breaks the path cheapest, usually IMDSv2 or the open port. More in attack paths vs. misconfigurations.

Do we need a tool for this at all?

For these five, not necessarily: the commands above work, and AWS Security Hub CSPM checks them as controls. Fixing all five without us is a good outcome. A tool earns its place when you have many accounts and Regions, more than one cloud, or want these findings joined to identity and data so you can see which ones chain.

Where Onam fits

Onam's posture scanning connects through read-only cloud roles and checks these five, and the rest of its AWS rule definitions, on every scan, across accounts and Regions. A finding that sits on an attack path from an internet-facing resource to a data store or key is ranked above one that does not. The free plan covers this kind of API-based posture scanning.

Frequently asked questions

How do I check if an S3 bucket is public with the AWS CLI?

Run aws s3api get-bucket-policy-status --bucket <name>. "IsPublic": true means the bucket policy makes it public. Also check the account-level setting with aws s3control get-public-access-block --account-id <id>.

How do I find EC2 instances that still allow IMDSv1?

Run aws ec2 describe-instances --filters Name=metadata-options.http-tokens,Values=optional in each Region. Those instances accept IMDSv1; require IMDSv2 with modify-instance-metadata-options --http-tokens required.

How do I tell if an RDS snapshot is public?

Run aws rds describe-db-snapshot-attributes --db-snapshot-identifier <id>. If the restore attribute's values include all, any AWS account can copy or restore it.

Are these checks safe to run in production?

The check commands only read configuration. The fix commands change resources, so run them through your change process.

Try it on your own cloud

Start free. The free plan covers up to 25 units of cloud security, with API-based scanning only: posture (CSPM), identity and permissions (CIEM), data stores found through cloud APIs (DSPM checks, no content classification) and AI-SPM. Posture scanning connects through read-only cloud roles, the free plan deploys no agent or scanner, and no card is needed. Register, and the team emails you the login.

Start free · Book a demo

See this on your own cloud, free

The free plan covers up to 25 units of cloud security with read-only cloud API scanning. It deploys no agent or scanner and needs no card. Register, and the team emails you the login.