Attack scenario · AWS identity & access

Compromised AWS access key

What happens when an AWS access key is compromised? A long-lived IAM user access key leaks from a developer laptop or repository and is used to explore the account, add persistence and read data.

Fictional, educational scenarioData exposurePersistent accessPrivilege takeoverLast updated · ATT&CK v20.1

Attack path · 5 stages

  1. 1

    Validate the stolen key

    T1078.004

  2. 2

    Discover identities and resources

    T1580T1087.004

  3. 3

    Add backup credentials

    T1098.001

  4. 4

    Escalate privileges

    T1098.003

  5. 5

    Collect data from storage

    T1530

For leadership

Executive summary

A single leaked access key is one of the most common ways AWS incidents start. Unlike a password, a key does not need MFA, does not expire by default and works from anywhere on the internet. Whoever holds it can do everything the key’s owner can do — and if that identity has broad permissions, they can read sensitive data, create new credentials so they keep access after the key is revoked, and in some cases escalate to full administrator control. The business question is not only "was a key leaked?" but "what could that key reach, would we notice it being used, and could we reliably remove every foothold it created?" Reducing long-lived keys, narrowing their permissions and rehearsing the response are inexpensive measures that sharply reduce this risk.

For engineers

Technical summary

The adversary validates the key with sts:GetCallerIdentity, enumerates permissions and resources, establishes persistence (new access keys or login profiles on other users, or new roles), then collects data from S3 or other stores. CloudTrail management events record most of these steps; S3 object reads require data events.

Environment and assumptions

Fictional company: a 60-person SaaS business with five AWS accounts in an AWS Organization. A legacy CI integration still uses an IAM user ("deploy-legacy") with a long-term access key and an attached policy granting s3:* and iam:* on all resources. A developer copied the key into a local .env file that was later pushed to a public repository fork.

  • The leaked key is active and belongs to an IAM user with broad S3 and IAM permissions.
  • CloudTrail management events are enabled; S3 data events are not.
  • No SCP restricts IAM user key creation.
  • The scenario is fictional and simplified for education; it does not describe a specific real incident.

Interactive

Attack sequence

Select a stage, or use the arrow keys, to see preconditions, evidence and controls.

Stage 1

Validate the stolen key

The adversary confirms the key works and learns which identity and account it belongs to.

Preconditions
  • Key is active
  • Key is not restricted by source IP or VPC conditions
Required access
  • Possession of the access key ID and secret.
Potential evidence
  • CloudTrail: sts GetCallerIdentity from an unfamiliar IP or user agent
  • GuardDuty findings for credential use from unusual infrastructure
Defensive controls
  • Replace long-term keys with roles or federation
  • Restrict key use with aws:SourceIp / aws:SourceVpce conditions where feasible
Representative AWS API calls
  • sts:GetCallerIdentity
Text version of the attack sequence
  1. Validate the stolen key (T1078.004). The adversary confirms the key works and learns which identity and account it belongs to. Preconditions: Key is active; Key is not restricted by source IP or VPC conditions. Evidence: CloudTrail: sts GetCallerIdentity from an unfamiliar IP or user agent; GuardDuty findings for credential use from unusual infrastructure. Controls: Replace long-term keys with roles or federation; Restrict key use with aws:SourceIp / aws:SourceVpce conditions where feasible.
  2. Discover identities and resources (T1580, T1087.004). Using the key’s read permissions, the adversary lists users, roles, policies, buckets and compute to plan next steps. Preconditions: Key has List*/Get*/Describe* permissions. Evidence: CloudTrail: bursts of iam:ListUsers, ListRoles, ListAttachedUserPolicies, s3:ListBuckets, ec2:DescribeInstances from one identity; Many AccessDenied errors as the adversary probes permissions. Controls: Least-privilege policies on automation identities; Alerting on high-volume discovery from non-human identities.
  3. Add backup credentials (T1098.001). Because the policy allows iam:*, the adversary creates an additional access key on another IAM user so that revoking the leaked key does not remove access. Preconditions: iam:CreateAccessKey on other users; Target users have fewer than two keys. Evidence: CloudTrail: iam CreateAccessKey where the caller is not the key owner; New key used shortly after creation from the same infrastructure. Controls: Remove iam:* from automation identities; SCP denying CreateAccessKey outside a break-glass role; Alert on CreateAccessKey / CreateLoginProfile.
  4. Escalate privileges (T1098.003). The adversary attaches an administrator policy to a user they control or modifies a role trust policy so they can assume a privileged role. Preconditions: iam:AttachUserPolicy / PutUserPolicy or iam:UpdateAssumeRolePolicy. Evidence: CloudTrail: AttachUserPolicy with AdministratorAccess, UpdateAssumeRolePolicy outside change windows. Controls: Permission boundaries on delegated identities; Alerting on IAM policy and trust changes.
  5. Collect data from storage (T1530). The adversary downloads objects from buckets that look like backups, exports or customer data. Preconditions: s3:GetObject on sensitive buckets; Objects not protected by a separately governed KMS key. Evidence: Only visible with S3 data events or S3 server access logs; Unusual egress volume; GuardDuty S3 Protection findings. Controls: Enable S3 data events on sensitive buckets; SSE-KMS with customer managed keys and scoped key policies; Bucket policies restricted to expected principals.

Technique mapping

MITRE ATT&CK and ATLAS techniques referenced in this scenario
IDTechniqueTactics (official)Stages
T1078.004Valid Accounts: Cloud AccountsInitial Access, Persistence, Privilege Escalation, Stealth1
T1580Cloud Infrastructure DiscoveryDiscovery2
T1087.004Account Discovery: Cloud AccountDiscovery2
T1098.001Account Manipulation: Additional Cloud CredentialsPersistence, Privilege Escalation3
T1098.003Account Manipulation: Additional Cloud RolesPersistence, Privilege Escalation4
T1530Data from Cloud StorageCollection5

Technique names and tactic assignments come from the imported MITRE data. Mapping a stage to a technique is Securitain’s analysis.

Why the attack can succeed

  • Long-term keys never expire and are not protected by MFA, so possession is enough.
  • The automation identity was given iam:* "to make deployments easier", turning a data-access key into an identity-administration key.
  • Without S3 data events, the organization cannot later prove which objects were read.
  • Revoking the original key does not remove credentials or roles the adversary created afterwards, or sessions already obtained.

What prevents or limits the attack

What may detect the attack

Detection signals and telemetry sources
SignalTelemetry sourceNotes
GetCallerIdentity or first use of a key from a new IP / ASNCloudTrail management eventsUseful only with a baseline of where the key is normally used.
CreateAccessKey / CreateLoginProfile by a principal other than the target userCloudTrail management eventsHigh signal; alert in real time.
Policy attachment or trust-policy change outside change windowsCloudTrail management events—
Bulk GetObject from a single identityCloudTrail S3 data events or S3 server access logsNot available unless enabled before the incident.
Credential use from anonymizing or unusual infrastructureGuardDuty—

Telemetry only helps if it is enabled before the incident and someone acts on it. Listing a signal here does not mean it is collected or monitored in your environment.

What Securitain may assess

  • Securitain can assess todayInventory of IAM users, roles, groups, policies, access-key configuration and trust relationships across connected AWS accounts. Learn more
  • Securitain can assess todayCredential prioritization — surfacing access keys and identities whose permissions make a leak more damaging. Learn more
  • Securitain can assess todayEffective-permission view that considers managed, inline, group, boundary and SCP policies together. Learn more
  • Securitain can assess todayPrivilege-escalation risk analysis for supported combinations such as iam:PassRole with Lambda, EC2, ECS or CloudFormation. Learn more
  • Outside Securitain’s current scopeReal-time detection of attacker activity in CloudTrail is not part of Securitain’s current assessment — use GuardDuty, a SIEM or your SOC for that.

For leadership

Executive implications

confidentiality
Customer or internal data in reachable buckets may be copied; without data events the scope may be impossible to determine precisely.
integrity
New identities or modified policies can let the adversary change infrastructure or data later.
operations
Response requires enumerating and revoking every credential and session created, which can disrupt deployments.
compliance
May trigger breach-notification assessment under contracts or regulation depending on the data involved.

No financial loss estimates are given; impact depends on the data, contracts and regulation involved.

Next steps

  1. Find every IAM user with an active access key; assign an owner or deactivate it.
  2. Remove iam:* and other IAM write actions from automation identities.
  3. Add an alert on CreateAccessKey, CreateLoginProfile and policy attachment by unexpected principals.
  4. Enable S3 data events (or server access logs) on buckets holding regulated or customer data.
  5. Write and rehearse a key-compromise runbook that includes revoking active role sessions.

References

MITRE ATT&CK® and ATT&CK® are registered trademarks of The MITRE Corporation. ATT&CK data © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation (ATT&CK v20.1). Securitain is not affiliated with or endorsed by MITRE. Explanations, scenarios and control mappings on this page are Securitain’s own analysis. Sources and licensing

Stay in the loop

Cloud security insights, early access & compliance updates

Weekly InsightsEarly AccessExpert Content
No spam, everUnsubscribe anytimeWeekly updates
Chat with Securitain