CCyberwiki

Stolen cloud credentials

Stolen cloud credentials
ClassSecrets, Access control
Also known asCloud account compromise; valid cloud accounts
OWASP Top 10A07:2025 Authentication Failures
MITRE ATT&CKT1078.004 Valid Accounts: Cloud Accounts
Typical severityCritical
AffectsAWS, Google Cloud and Azure accounts reached through access keys, service account keys, managed identities and console passwords

A stolen AWS access key is often tested first with one request, GetCallerIdentity, which returns the account number and the name of the user or role the key belongs to. The call needs no permissions and succeeds even when a policy explicitly denies it.1 From that answer the attacker knows whose account they are in, and every request after it is made as that identity. A valid account gives the first way in, keeps access open while the credential lasts, and can be used to raise privileges and to avoid defences.2

The key reaches the attacker by the routes described in Exposed credentials in source code repositories, Exposed sensitive files and Cloud instance metadata service, or a password is phished or guessed.2 A found key that reaches only one paid service is the narrower case of Abuse of leaked API keys.

Long-term and temporary credentials

AWS has two kinds of access key, and the first four letters of the key ID say which. An ID starting AKIA belongs to an IAM user (a named user inside the account) or the root user and stays valid until someone deletes it. An ID starting ASIA is a temporary credential issued by the Security Token Service and expires on its own.3 Temporary credentials last between 15 minutes and 36 hours, 12 hours by default.4 A long-term key saved in a .env file of environment variables in 2021 still works in 2026 if nobody deleted it.

In Datadog's 2025 sample, 59% of AWS IAM users had an active access key older than one year, and more than half of those users had not used their keys for over 90 days. Of Google Cloud service accounts, 55% had active keys older than a year, as did 40% of Microsoft Entra ID applications. Earlier editions found long-lived credentials to be the most common cause of publicly documented cloud breaches.5 In the incidents Google saw in its own cloud, weak or missing credentials gave the first access in 47.1% of cases in the first half of 2025 and 27.2% in the second, when exploited software overtook them.6

What follows the first request

After confirming the identity, the attacker lists what it can reach (Cloud discovery), then tries to widen its rights. A credential that may create roles or attach policies can grant itself administrator access.7 A misconfigured role assignment or role assumption policy can also let an account use permissions beyond the ones it was meant to have.2 An attacker may also add a credential of its own, such as a new access key or role, so that rotating the stolen one does not end the intrusion; such an extra credential can also sidestep Multi-factor authentication (Additional cloud credentials).2

What happens next depends on the attacker's goal: servers for Cryptojacking, functions that scan for more keys (Serverless function abuse), copying out storage and databases (Data exfiltration), or deleting data and demanding payment (Ransomware and data destruction). Hiding the activity usually takes delete, disable or stop calls such as StopLogging, DeleteFlowLogs and DisableAlarmActions (Disabled and deleted logs).8

The 2024 environment file campaign

In August 2024, Unit 42 at Palo Alto Networks described an extortion operation that collected AWS keys from .env files left readable on websites. It targeted 110,000 domains and gathered over 90,000 unique variables, of which 7,000 belonged to cloud services.7 Table 1 lists the calls it made in the victims' accounts.

Table 1. AWS calls in the 2024 campaign, in order
CallPurpose
GetCallerIdentityConfirm the key works and read the account and identity
ListUsers, ListBuckets, GetSendQuotaFind IAM users, storage buckets and the email sending limit
CreateRole, AttachRolePolicyCreate a role named lambda-ex with the AdministratorAccess policy
CreateSecurityGroup, RunInstancesStart compute-optimised servers open on every port; failed for lack of permission
CreateFunction20150331Deploy a scanning function in one region, then in every enabled region within a second
S3 reads and deletesCopy bucket contents, delete them and leave a ransom note in the empty bucket

The server attempt took under a minute, the sign of a script. The data was not encrypted; it was copied, deleted and held for ransom. The attackers came in through the Tor anonymity network and copied data out through a VPN. Unit 42 traced the success to the victims' exposed files and over-broad permissions; the cloud services themselves had no vulnerability or misconfiguration.7

Detection

Amazon GuardDuty groups its IAM findings by attacker goal, for example Discovery:IAMUser/AnomalousBehavior, Exfiltration:IAMUser/AnomalousBehavior, Stealth:IAMUser/CloudTrailLoggingDisabled and UnauthorizedAccess:IAMUser/TorIPCaller. One finding fires when temporary credentials created on an EC2 server are used from a host outside AWS, a sign that they were copied off the server, for example through its instance metadata service.8

In CloudTrail, the AWS record of API calls, Event history shows the creation of access keys, policies, roles and temporary credentials.9 Reads and deletes of individual S3 objects appear only in S3 access logs or CloudTrail data events, and neither is on by default. Without them, the cost and usage report shows hourly or daily spikes in bytes read and deleted, but no single request.7

Limiting a stolen credential

A credential that expires on its own limits how long a theft lasts: roles give the same access as access keys through temporary credentials (Short-lived credentials and OIDC federation). Least privilege limits what the theft can do; withholding iam:CreateRole and iam:AttachRolePolicy would have blocked the escalation step in the 2024 campaign. Disabling unused regions removes the places where attackers start resources out of sight.7 For people, 79% of organisations in the same Datadog sample sign in to the AWS console through federated single sign-on such as AWS IAM Identity Center or Okta, and 39% still use IAM users in some form.5

After a theft

AWS's steps are to replace an exposed key, deactivate the old one, delete it once the application works without it, and delete root user access keys nobody needs. CloudTrail is then searched for keys, roles and policies the attacker created, IAM users the owner did not create are deactivated, every region is checked for unknown resources, and the root user gets two-factor authentication.9 Deleting a key does not end sessions already issued from it, because temporary credentials stay valid until they expire. A policy that denies all actions, attached to the IAM user or role, cuts them off; the managed AWSDenyAll policy has the same permissions.4 The general steps are in Responding to a leaked API key.

In SecFlash

SecFlash reports cloud keys before they are stolen: a key in the repository or its history as SF-SEC-702 on the Security page, a secret key in the live site's JavaScript or HTML as SF-EXP-301 and SF-EXP-304, and a readable environment file, the source in the 2024 campaign, as SF-EXP-307, all on the Exposure page. A proxy that answers requests for the cloud metadata address appears as SF-SEC-619 on the Security page.

See also

References

  1. back Amazon Web Services. "GetCallerIdentity". AWS Security Token Service API Reference.
  2. a b c d MITRE (version 2.0, modified 12 May 2026). "Valid Accounts: Cloud Accounts, Sub-technique T1078.004". MITRE ATT&CK.
  3. back Amazon Web Services. "Remediating potentially compromised AWS credentials". Amazon GuardDuty User Guide.
  4. a b Amazon Web Services. "Disabling permissions for temporary security credentials". AWS Identity and Access Management User Guide.
  5. a b Datadog (2025). "State of Cloud Security". Datadog.
  6. back Google Cloud (2026). "Cloud Threat Horizons Report H1 2026". Google Cloud.
  7. a b c d e Unit 42 (15 August 2024). "Leaked Environment Variables Allow Large-Scale Extortion Operation in Cloud Environments". Palo Alto Networks.
  8. a b Amazon Web Services. "GuardDuty IAM finding types". Amazon GuardDuty User Guide.
  9. a b "Resolve issues with unauthorized activity in AWS accounts". AWS re:Post Knowledge Center. Amazon Web Services.