AWS Account Compromise: Stolen Access Keys, Secret Harvesting and Persistence
| Attack type | Cloud account compromise, credential theft, persistence, defense evasion, resource hijacking |
| Threat actors | Unattributed. Built from an AWS account compromise Fluency investigated, and tested against the AWS techniques of Stratus Red Team |
| Coverage since | November 14, 2026 |
| Platforms | Amazon Web Services: CloudTrail, and Amazon GuardDuty |
A stolen key is tested before it is used. Access keys leak from code, backups, CI variables and laptops, and an attacker who collects a batch does not know what each one can reach. So they ask: who am I, and what can I do? In an AWS compromise Fluency investigated, the attacker tested the keys one by one, and that testing is what gave them away. Fluency's detections built from it catch 36 of the 38 attacker keys in that incident.
The threat
- Keys that never expire. An IAM user's access key works until someone disables it. Keys copied into a repository, a build pipeline or a backup years ago still work today.
- Testing what a key can reach. The attacker calls
GetCallerIdentityto confirm the key works, then tries other services. Most attempts are refused; each refusal tells them where the key's permissions end. - Secrets first. A working key goes straight for Secrets Manager and SSM Parameter Store, where database passwords, API tokens and other keys are kept, read in bulk.
- Access that outlives the key. Before the key is disabled, the attacker makes sure they can come back: a federation token, an IAM Roles Anywhere trust anchor, a Lambda function anyone can call or that runs their code, SSH keys pushed to instances, commands run through Systems Manager.
- Logging turned down, not off. Stopping a trail is noticed. Narrowing what a trail records, deleting DNS query logging, or taking the account out of its AWS Organization, which drops the organization's policies and central logging, is quieter.
- The bill. Stolen keys run cryptominers on GPU and bare-metal instances, and enable Amazon Bedrock model access to resell or abuse it at the account's expense.
Why it gets past defenses
- The calls are ordinary.
GetCallerIdentity, a refused call, a secret read, an SSM command: engineers and automation make the same calls every day. - Refusals are noise. Consoles, agents and AWS's own services are refused constantly. A rule on every refused call is either muted or ignored.
- Persistence looks like configuration. A trust anchor, a resource policy or a code update is how teams deploy and run workloads.
- Stolen instance credentials blend in. Credentials taken from an instance and used from another EC2 instance in the same region are hard to tell apart from the instance's own calls in CloudTrail.
How Fluency catches it
Fluency follows each identity in CloudTrail, learns what it normally does, and alerts on what a stolen key does first.
- The test. An access key or role that checks its identity for the first time in 30 days and is then refused APIs it has never been refused, within the hour, is a key being explored. Across two or more services, a single match opens an incident.
- The burst. One address using the keys of several IAM users within an hour is someone working through a list of stolen keys.
- The harvest. A person reading many distinct secrets or parameters within an hour, or reading secrets in bulk for the first time, raises an alert. Roles, which read secrets by design, are left out.
- The way back in. Federation tokens, Roles Anywhere trust anchors, publicly invokable Lambda functions, Lambda code replaced by a new identity, SSH keys pushed through EC2 Instance Connect or the serial console, and SSM commands from an identity that has not run them before each raise an alert.
- The cover-up. Changing what a trail records, deleting DNS query or Bedrock invocation logging, leaving the AWS Organization and turning on serial console access are reported on every attempt, refused ones included.
- The bill. The first launch of accelerator or bare-metal instances by an identity, and Bedrock model access being enabled, raise an alert.
- What CloudTrail cannot show. Amazon GuardDuty findings become Fluency alerts at their own severity, and a critical finding opens an incident. GuardDuty reports instance credentials used from another AWS account, which CloudTrail alone does not reliably show.
Each detection was measured against 30 days of real customer AWS activity before release, with AWS's own automation, deployment pipelines, Kubernetes node launches and instance agents tuned out. Replaying the public attack logs of 36 Stratus Red Team AWS techniques, the techniques Fluency does not detect fell from 20 to 3.
Detections included
| Detection | What it catches |
|---|---|
| Stolen key reconnaissance | A key or role checks its identity for the first time in 30 days, then is refused new APIs within the hour; across several services it opens an incident. |
| Key burst from one address | The access keys of more than four IAM users used from one address within an hour. |
| Refused API call | An identity refused for the first time, now including EC2's refusals such as reading an instance's Windows password. |
| Secret harvesting | Many distinct Secrets Manager secrets or SSM parameters read by a person within an hour, or secrets read in bulk for the first time. |
| Federation token | An IAM user requests a federation token for the first time, keeping access after the key is disabled. |
| Roles Anywhere trust | A trust anchor or profile created, giving long-lived role access from outside AWS. |
| Lambda backdoor | A function opened to be invoked by anyone, or its code replaced by an identity that has not updated it before. |
| Access to instances | SSM commands and sessions, and EC2 Instance Connect keys, from an identity doing it for the first time; any SSH key sent to an instance's serial console. |
| Logging and monitoring turned off | A trail stopped, deleted or narrowed to record less; GuardDuty, VPC flow logs, AWS Config, DNS query logging or Bedrock invocation logging turned off. |
| Guardrail bypass | An account trying to leave its AWS Organization, or serial console access turned on. |
| Compute and model abuse | Accelerator or bare-metal instances launched by an identity for the first time, and Bedrock model access enabled. |
| GuardDuty findings | Critical, high and medium GuardDuty findings, including stolen instance credentials used from another AWS account. |
MITRE ATT&CK
| Tactic | Technique |
|---|---|
| Initial Access, Persistence | T1078.004 Valid Accounts: Cloud Accounts |
| Discovery | T1526 Cloud Service Discovery, T1580 Cloud Infrastructure Discovery |
| Credential Access | T1555.006 Credentials from Password Stores: Cloud Secrets Management Stores, T1552.005 Unsecured Credentials: Cloud Instance Metadata API |
| Persistence | T1098.001 Account Manipulation: Additional Cloud Credentials, T1098.004 Account Manipulation: SSH Authorized Keys |
| Execution | T1651 Cloud Administration Command, T1648 Serverless Execution |
| Defense Evasion | T1562.008 Impair Defenses: Disable or Modify Cloud Logs, T1666 Modify Cloud Resource Hierarchy |
| Impact | T1496.001 Resource Hijacking: Compute Hijacking, T1496.004 Resource Hijacking: Cloud Service Hijacking |
Get this coverage
The CloudTrail detections are on every Fluency instance that collects AWS CloudTrail through the AWS CloudTrail integration. The GuardDuty detections need the Amazon GuardDuty integration. For full coverage:
- Send CloudTrail from every account and region, including management events from your AWS Organization's management account, so every attempt to change logging or leave the organization is seen.
- Connect Amazon GuardDuty if you have it on. GuardDuty findings arrive about 25 to 40 minutes after the activity starts.
- On a newly connected instance, the detections first learn which identities run commands, deploy functions and launch instances, so expect more AWS alerts in the first weeks.
Detection shortens the attacker's window; removing long-lived keys closes it. Pair the detections with prevention:
- Replace IAM user access keys with roles and short-lived credentials wherever you can, and disable keys that have not been used recently.
- Keep secrets out of code and pipelines, and scope who can read them in Secrets Manager and Parameter Store.
- Use service control policies to stop accounts leaving the organization and to deny the regions and instance types you never use.
Not a customer yet? Start a free trial or book a demo.
Related
- Identity persistence and privilege abuse: the same idea, access that outlives a reset, in Microsoft Entra ID.
- New AWS Detections: Stolen Access Keys, Secret Harvesting and GuardDuty Findings: what changed and what to do.
- AWS Detection Update: the release notes, with each rule's match conditions, what the rules do not cover, and triage guidance.
- Stratus Red Team attack techniques and AWS's GuardDuty finding types.