Most AWS credential theft incidents aren't sophisticated attacks against hardened systems. They exploit basic IAM misconfigurations that have been documented for years. Here are the five mistakes that show up most often in post-incident reports — and what to do instead.
Mistake 1: Long-term access keys for automated workloads
If your CI/CD pipeline, Lambda function, EC2 instance, or containerized workload authenticates to AWS using an access key stored in a config file, environment variable, or secrets manager — you have a target on your back.
Long-term access keys don't expire. A key leaked from a GitHub Actions workflow secret, a Dockerfile build arg, or a .env file committed six months ago remains valid today unless someone manually rotates it. Attackers know this. They harvest old GitHub commits specifically looking for keys that might still work.
The fix: Use IAM roles everywhere automated workloads run. EC2 instances get an instance profile. Lambda functions get an execution role. ECS tasks get a task role. GitHub Actions uses OIDC federation — no stored keys at all. Every major AWS service has a mechanism for role-based authentication. There is no legitimate reason to use an access key in an automated workload.
Audit: aws iam generate-credential-report and look for access keys that haven't been used in 30+ days. Rotate or delete them. Then check your CI/CD environment variables, Kubernetes Secrets, and SSM Parameter Store for anything that looks like AKIA....
Mistake 2: AdministratorAccess on service roles
It's tempting to attach AdministratorAccess to a service role "just to get things working" during initial development, then never revisit it in production. The result: every Lambda, EC2 instance, or ECS task running under that role is a full administrator of your AWS account.
When an attacker compromises those credentials — through a dependency vulnerability, SSRF attack, or leaked environment variables — they inherit full administrator access. They can create IAM users, attach policies, launch any instance type in any region, exfiltrate data from S3, and disable CloudTrail. One compromised service credential becomes a complete account takeover.
The fix: Apply least privilege. Start with the AWS Policy Simulator or IAM Access Analyzer to identify what permissions your workloads actually use. IAM Access Analyzer's unused access findings will show you roles with permissions they've never exercised. Remove them. At minimum, any role that should never call RunInstances should have an explicit Deny on ec2:RunInstances — that single Deny would stop cryptomining cold regardless of how the credentials were obtained.
Mistake 3: No MFA on IAM users with console or API access
IAM users with console access and no MFA can be compromised through phishing alone. No credentials need to be leaked — a convincing fake AWS login page is enough. Once the attacker has the password, they're in.
This matters more than it used to because attackers are increasingly targeting AWS console access specifically, not just API keys. Console access gives them the ability to disable CloudTrail, modify SCPs, and make changes that don't show the access key ID — making attribution harder.
The fix: Enforce MFA via an IAM policy condition. The following policy denies all actions unless MFA is present:
{
"Version": "2012-10-17",
"Statement": [{
"Effect": "Deny",
"NotAction": ["iam:CreateVirtualMFADevice", "iam:EnableMFADevice",
"iam:GetUser", "iam:ListMFADevices", "iam:ListVirtualMFADevices",
"iam:ResyncMFADevice", "sts:GetSessionToken"],
"Resource": "*",
"Condition": {
"BoolIfExists": {"aws:MultiFactorAuthPresent": "false"}
}
}]
}
Attach this to all IAM users or to a group all IAM users belong to. Better yet: use AWS SSO / IAM Identity Center instead of IAM users. It has MFA enforcement built in and doesn't require managing user credentials at all.
Mistake 4: CloudTrail enabled but nobody watching it
CloudTrail is enabled by default for management events. Ninety percent of AWS accounts have it on. Far fewer have anyone — or anything — watching it in real time.
Enabling CloudTrail is not the same as monitoring CloudTrail. An attacker who compromises credentials and starts launching instances in ap-southeast-1 will appear in your CloudTrail logs within seconds. But if you only look at CloudTrail logs during incident investigations, you'll find that data after the fact, not in time to prevent damage.
A specific pattern worth watching for: sts:GetCallerIdentity from an IP address that has never appeared in your account before. This is almost always the first call an attacker makes after obtaining credentials — it validates that the keys work and reveals the account ID. It costs nothing, it's completely harmless, and it's the clearest possible signal that someone new is using your credentials.
The fix: Set up EventBridge rules on CloudTrail events. At minimum, alert on: ec2:RunInstances in regions you don't operate in, cloudtrail:StopLogging anywhere, iam:CreateUser or iam:AttachUserPolicy by non-human principals, and sts:GetCallerIdentity from unknown IP ranges. These four rules catch the vast majority of credential abuse scenarios.
Mistake 5: No permission boundaries on user-created roles
If your application or CI/CD pipeline has iam:CreateRole or iam:AttachRolePolicy permissions, an attacker who compromises those credentials can create a new role with Administrator access, assume it, and escalate their privileges beyond what the original credentials allowed.
This is IAM privilege escalation — a well-documented attack path that bypasses many security controls. The original compromised credentials might have limited permissions. But if they can create IAM roles, those limited credentials become a stepping stone to full account access.
The fix: Apply permission boundaries to any principal that can create IAM resources. A permission boundary is an IAM policy that sets the maximum permissions any role created by that principal can have. Even if the attacker creates a new role and attaches AdministratorAccess, the permission boundary caps what that role can actually do.
Example: a deployment role that needs to create service roles should have a permission boundary that prevents those roles from ever having IAM write permissions. The deployment role can create roles for Lambda and EC2, but those roles can never create more IAM resources — breaking the escalation chain.
The common thread
All five mistakes share the same root cause: IAM is configured for convenience during development and never hardened for production. Long-term keys are easier than roles. AdministratorAccess is faster than least-privilege. No MFA means one fewer step to log in.
Each convenience trade-off is a force multiplier for attackers. Fix any one of them and you significantly raise the cost of a credential compromise. Fix all five and a leaked key becomes a recoverable nuisance instead of a six-figure incident.
The last line of defense — after prevention fails — is detecting the compromise before it becomes expensive. When credentials are used from an unknown IP in an unused region, the window between "attacker has access" and "damage is done" is measured in minutes. SpikeCatcher detects this in under 15 minutes via real-time CloudTrail monitoring. 5-min setup, free 14-day trial.
Related articles
AWS credential theft: the first 10 minutes
A timeline of what actually happens in the first 10 minutes after AWS keys leak to a public GitHub repo — and what real-time detection looks like.
The access key nobody retired: how to find and kill stale AWS keys
A vendor key, never retired, found in their environment. Audit commands to find unused AWS access keys, check what they did, and retire them safely.
Bought the wrong Savings Plan? You have a short window to return it
AWS lets you return a mistaken Savings Plan for a limited time. The exact rules, the calendar-month trap, and which plans cannot be returned.
Protect your AWS account — 14-day free trial
Real-time threat and cost anomaly detection. Detects credential theft, cryptomining, and runaway costs in under 15 minutes. 5-minute setup via CloudFormation.
No credit card. Cancel anytime.