AWS Builder Center
Common AWS Misconfigurations Hackers Look For (And How to Fix Them)

Common AWS Misconfigurations Hackers Look For (And How to Fix Them)

A practical, in-depth guide from an offensive security perspective, detailing the most common AWS security flaws like public S3 buckets, overly permissive IAM roles, exposed access keys, and open security groups, along with precise technical remediation steps.

Cybersecurity Student | Pentester | AWS Cloud Learner
When I started doing bug bounty and pentesting, I quickly realized something. Attackers do not always break in through complex zero-day exploits. Most of the time, they walk through a door that was left wide open.
In the cloud, that open door is called a misconfiguration.
A recent 2026 Cloud Security Index report analyzed data from 3,000 organizations and found that AWS accounts have the highest prevalence of misconfigurations in five out of six security categories compared to other cloud providers. This is not because AWS is insecure. It is because AWS is complex. More services mean more settings, and more settings mean more opportunities for human error.
In this article, we will look at AWS through the eyes of an attacker. We will examine the most common misconfigurations that lead to real-world breaches and, more importantly, how to fix them using official AWS documentation and precise technical steps.

1. The Public S3 Bucket Problem

The public S3 bucket is the classic cloud security horror story. It has been the cause of countless data breaches, from leaked customer records to exposed government documents.

How Attackers Find It

Attackers use automated tools that constantly scan the internet for S3 buckets that allow public listing or public read access. If a bucket is misconfigured to allow  s3:ListBucket  and  s3:GetObject  to everyone ( * ), the attacker can simply download the entire contents using the AWS CLI or a simple  curl  command against the bucket's REST endpoint.

The Technical Misconfiguration

By default, AWS now blocks public access to S3 buckets. However, developers often disable these settings to host static websites or share files quickly.
The problem is that AWS evaluates Block Public Access settings at multiple levels: organization, account, and bucket. S3 always applies the most restrictive combination of these settings . A common mistake is disabling block public access at the bucket level, but forgetting that the account-level setting is still active, causing confusion. The reverse is worse: an admin might disable account-level blocking, exposing every bucket in the account .
Furthermore, the definition of "public" is specific. A bucket policy is considered public if it grants access to the  AllUsers  or  AuthenticatedUsers  groups, or if it grants access to a wildcard principal ( * ), or if it uses an IP condition with a very broad CIDR block (e.g.,  0.0.0.0/0 ) .

The Fix

For Static Websites: Do not make the S3 bucket public. Instead, use Amazon CloudFront with Origin Access Control (OAC). This allows CloudFront to read from a private S3 bucket and serve the content to users. The bucket remains private, and the website still works .
For Everything Else: Enable S3 Block Public Access at the account level. This ensures that even if a developer accidentally writes a public bucket policy, S3 will block it. The account-level setting overrides any bucket-level policy that attempts to disable it .
CLI Command to Block Public Access at Account Level:
bash
aws s3control put-public-access-block \
--account-id <your-account-id> \
--public-access-block-configuration \
BlockPublicAcls=true,IgnorePublicAcls=true,BlockPublicPolicy=true,RestrictPublicBuckets=true
How to Audit It: Use IAM Access Analyzer for S3. It reviews your bucket policies and identifies buckets that are shared with external entities or are publicly accessible. You can see the public access status directly in the S3 console's "IAM Access Analyzer" column .

2. Overly Permissive IAM Policies

If S3 is the most famous misconfiguration, IAM is the most dangerous. According to the 2026 report, 83% of AWS accounts have IAM policies that allow privilege escalation. This means an attacker with low-level access can escalate their permissions to full administrator.

How Attackers Exploit It

IAM is complex. A policy that looks safe at first glance might grant a user the ability to create a new IAM policy that grants themselves admin access. For example, a user with  iam:CreatePolicyVersion  and  iam:SetDefaultPolicyVersion  can create a new version of a policy attached to their user and set it as the default, instantly granting themselves more permissions.

The Technical Misconfiguration

The most common IAM mistakes are:
  • Using  "Action": "*"  and  "Resource": "*" : This grants full admin access to everything.
  • Using wildcards in actions:  "s3:*"  grants all S3 actions, including delete, when the user only needed read.
  • Not using conditions: A policy that allows  sts:AssumeRole  without a condition can be used by any principal in the account.
AWS evaluates policies based on a simple rule: an explicit Deny always overrides an Allow. However, if there is no explicit deny, and any policy allows the action, the request is allowed. This means a single overly permissive policy in a sea of restrictive ones will grant access.

The Fix

Principle of Least Privilege: Start with zero permissions and add only what is needed. Use the IAM Access Analyzer to identify unused permissions. It generates findings for roles and users that have permissions they have not used in a specified window (e.g., 90 days). You can review these findings in the IAM console under "Access Analyzer" > "Unused access" .
Use Permission Boundaries: A permissions boundary sets the maximum permissions an IAM entity can have. Even if a policy allows  iam:* , the permissions boundary can restrict it to only what is explicitly allowed. This is a critical defense-in-depth measure for delegated administration .
Example Scenario: Maria creates a permissions boundary  XCompanyBoundaries  that denies S3 access. She then allows Zhang to create users, but only if he attaches this boundary. Even if Zhang attaches an  AdministratorAccess  policy to a new user, the boundary will block any S3 actions .
Review Managed Policies: Many AWS managed policies are broad. For example,  PowerUserAccess  sounds safe, but it grants almost full access to all services except IAM. Use it with caution.

3. Exposed Access Keys

Access keys are the equivalent of a username and password for programmatic access to AWS. If they leak, an attacker has the same access as the user.

How Attackers Find It

Bots scan GitHub, GitLab, and other public code repositories 24/7 for strings that look like AWS access keys (they start with  AKIA ). A leaked key is often exploited within minutes.

The Technical Misconfiguration

The mistake is hardcoding access keys directly into application code or configuration files that are committed to a public repository. Even if the repository is private, a disgruntled employee or a compromised developer account can leak it.

The Fix

Never Use Long-Term Access Keys: The best fix is to not use access keys at all. For applications running on EC2, use IAM Roles for EC2. The instance receives temporary credentials that rotate automatically. For applications running on Lambda, use the Lambda execution role.
If You Must Use Keys: Store them in AWS Secrets Manager or Parameter Store. Rotate them regularly (every 90 days). Add a  .gitignore  rule for any file that might contain credentials.
Detect Leaks: Use Amazon GuardDuty. It has a finding type called  UnauthorizedAccess:IAMUser/InstanceCredentialExfiltration  that detects when credentials are used from an unusual location. It also has findings for  Policy:S3/BucketPublicAccessGranted  and  Policy:S3/BucketBlockPublicAccessDisabled  which can alert you when a bucket is made public .

4. Permissive Security Groups and Network ACLs

Security groups act as a virtual firewall for your EC2 instances. A common misconfiguration is allowing inbound traffic from  0.0.0.0/0  on sensitive ports.

How Attackers Exploit It

If port 22 (SSH) is open to the world, attackers will attempt brute-force attacks. If port 3306 (MySQL) is open, attackers will try to connect directly to the database. If port 3389 (RDP) is open, they will try to exploit Windows vulnerabilities.
The 2026 report found that 84% of AWS accounts have permissive ingress to sensitive ports.
AWS Security Hub has specific controls for this:
  • EC2.18: Security groups should only allow unrestricted incoming traffic for authorized ports.
  • EC2.19: Security groups should not allow unrestricted access to ports with high risk.
  • EC2.21: Network ACLs should not allow ingress from  0.0.0.0/0  to port 22 or port 3389 .

The Fix

Use a Bastion Host: Place a single bastion host in a public subnet and restrict SSH access to your specific IP address. All other instances should be in private subnets with no internet-facing ports.
Use AWS Systems Manager Session Manager: This is the modern approach. It allows you to connect to instances without opening any inbound ports. The instance needs an IAM role with the  AmazonSSMManagedInstanceCore  policy, and the connection is tunneled through the AWS API. The SSM Agent (version 2.3.68.0 or later) must be installed on the instance .
CLI Command to Restrict a Security Group:
bash
# First, find the security group ID
aws ec2 describe-security-groups --filters Name=group-name,Values=your-sg-name

# Revoke the overly permissive rule
aws ec2 revoke-security-group-ingress \
--group-id sg-xxxxxxxx \
--protocol tcp \
--port 22 \
--cidr 0.0.0.0/0
Audit Regularly: Use AWS Config to monitor security group changes. Create a rule using the managed rule  restricted-ssh  which flags any security group allowing unrestricted inbound SSH from the internet .

5. Missing Logging and Monitoring

You cannot detect an attack if you are not logging anything.

The Technical Misconfiguration

A common scenario is an organization that has enabled CloudTrail but only for the management account, not for all member accounts in an AWS Organization. Or they have enabled CloudTrail but not configured it to log to a centralized S3 bucket, so logs are scattered.
Another issue is not enabling VPC Flow Logs, which capture network traffic metadata. Security Hub control EC2.6 specifically checks that VPC flow logging is enabled in all VPCs .

The Fix

Enable CloudTrail Organization Trail: Create a trail at the organization level that logs all accounts to a single S3 bucket in the management account. This is called an "organization trail" and it automatically applies to all member accounts. When a new account joins the organization, the trail is automatically added and logging starts .
Enable GuardDuty in All Accounts: Use AWS Organizations to automatically enable GuardDuty across all accounts and regions. It continuously monitors for malicious activity and unauthorized behavior.
Enable AWS Config: Config records resource configurations and changes. You can use it to detect when a resource drifts from your desired security baseline. For example, the managed rule  s3-bucket-public-read-prohibited  flags any S3 bucket that allows public read access .

6. The Offensive Security Mindset

As a pentester, the most valuable lesson I have learned about AWS security is this: assume breach.
Do not ask "Is this secure?" Ask "If an attacker had this credential, what could they do?" This mindset forces you to think about blast radius. A single overly permissive IAM role is not just a risk for that one user. It is a risk for the entire account.
The 2026 report showed that 98% of large enterprises have weak IAM controls. This means even the biggest companies with dedicated security teams struggle with this. The complexity of IAM is the enemy.
Start with the basics. Enable MFA on the root user. Do not use the root user for daily tasks. Block public access to S3 at the account level. Use IAM roles instead of access keys. Enable CloudTrail and GuardDuty. These are not advanced techniques. They are the foundation.
If you are a student learning cloud security, build a lab. Intentionally misconfigure an S3 bucket and see if you can access it from another account. Create an overly permissive IAM role and try to escalate your own privileges. The best way to understand the attack is to perform it in a safe environment.

7. Final Summary

AWS misconfigurations are not bugs in AWS. They are human errors. The cloud gives you incredible power and flexibility, but that power comes with responsibility.
The most common misconfigurations are public S3 buckets, overly permissive IAM policies, exposed access keys, open security groups, and missing logging. Each one has a specific, documented fix.
The key takeaway is this: security in AWS is not a one-time setup. It is a continuous process. Audit your account regularly. Use the tools AWS provides. And always think like an attacker.
Because the attacker is already thinking about you.
Any opinions in this article are those of the individual author and may not reflect the opinions of AWS.
Enjoyed reading this content? Let the author know!

Your likes, comments, shares, and saves help creators reach more builders.

Loading recommendations

Loading article