Skip to main content
Back
IntrusionAWS
12 min read

ECS on Fargate crypto mining with a leaked IAM user key

Victim
Several unnamed AWS environments
When
December 2023 to January 2024, days not statedDisclosed Jan 19, 2024
Entry
A leaked long-term IAM user access key, used from Indonesian addresses with residential proxy history; how the key leaked is not stated, and the post says leaked keys were the cause most of the time, not in every case.

Datadog Security Labs describes activity against AWS accounts in December 2023 and January 2024, from Indonesian addresses, most with residential proxy history, caused most of the time by a leaked long-term IAM user access key; how any key leaked is not stated. In one case the actor ran mining containers on ECS Fargate services in no fewer than 17 regions; in another the attacker added three administrator IAM users, signed in to the console, downloaded S3 objects and tried EC2 Instance Connect and a launch in an unused Region. The payout addresses in the mining images showed a zero balance on January 19, 2024.

What happened

External Parties
Indonesian proxy addresses
Docker Hub
NiceHash pool
Internet
AWS IAM and APIlong-term IAM user key
Victim AWS Accounts
Actor-Created Compute
Leaked IAM User Key
Attacker's Admin Users
S3 Buckets
EC2 Instances
ECS Fargate Services
us-west-1 Launch Attempt

Replaying the ECS Fargate mining cases, Dec 2023–Jan 2024

  1. 1

    Leaked key

    Dec 2023 – Jan 2024, day not stated

    A leaked long-term IAM user access key is accepted by the AWS API from Indonesian addresses, most with residential proxy history; how it leaked is not stated, and the credential of case 2 is not named.

  2. 2

    Fargate clusters in 17 regions

    Dec 2023 – Jan 2024, day not stated

    In case 2, with no enumeration first, the identity creates ECS clusters, Fargate task definitions and services of 25 tasks with public IPs in under two minutes, in no fewer than 17 regions; the tasks run public Docker Hub images that mine to a NiceHash pool.

  3. 3

    Administrator user and console

    Dec 2023 – Jan 2024, day not stated

    In case 1, within 11 seconds and likely by automation, the key creates an IAM user with AdministratorAccess and a console password; a few hours later the attacker signs in to the console as that user.

  4. 4

    Data, SSH, a new region and more users

    Dec 2023 – Jan 2024, day not stated

    From the console the attacker downloads S3 objects and pushes SSH keys through EC2 Instance Connect; with the original key it tries to launch two r6i.metal instances in us-west-1, an unused Region, which fails a Region verification check, then creates two more administrator users with access keys.

Impact

In case 2 the actor ran mining containers on ECS Fargate in no fewer than 17 regions of the victim's account, at the victim's cost; in case 1 the attacker added three administrator IAM users, downloaded objects from several S3 buckets and tried to reach EC2 instances and to launch instances in an unused Region.

Outcome

Where the provider's controls fit

On AWS, a service control policy that refuses IAM user calls without MFA, and one that accepts calls only from your organization's networks, bound the leaked long-term key: in a member account of an organization they refuse its calls, the second only where your keys are used from known networks. The post does not say whether the accounts belonged to an organization, and a service control policy does not apply to the management account. Service control policies that limit who may create ECS services, IAM users, login profiles and access keys, and that keep calls to your approved Regions, would have bounded the clusters in no fewer than 17 regions and the added administrators, though an exempt identity keeps those rights. VPC Block Public Access, set by a declarative policy, would have cut the tasks off from the Docker Hub image and the pool, but the clusters would still exist until removed. An AWS Sign-In policy that keeps console sign-in to your ranges, and a resource control policy that keeps S3 reads to your networks, bound the added user's sign-in and the console downloads in the same way: in a member account, and for requests from outside your networks. Resource control policies and VPC Block Public Access came in late 2024 and AWS Sign-In policies in 2026, after the incident. The public image is outside the provider's reach, and how the key leaked is not stated.

Could this have been prevented?

In hindsight, no control would have stopped it. 18 controls would have limited how far it went. 1 step has no cloud-provider control. The counts below are control assessments, not attack stages: several can address the same step. The same replay with the controls in place before the incident shows where each phase would have been refused or bounded.

0
Prevented
18
Contained
1
Not covered

How it could have been prevented

The same replay with the controls in place. Green marks where a step is refused, blue where it is bounded, and red where no control reaches it. Open a row to read the control, why it acts, and its caveat.

External Parties
Indonesian proxy addresses
Docker Hub
NiceHash pool
Internet
AWS IAM and APIlong-term IAM user key
Victim AWS Accounts
Actor-Created Compute
Leaked IAM User Key
Attacker's Admin Users
S3 Buckets
EC2 Instances
ECS Fargate Services
us-west-1 Launch Attempt

Replaying the ECS Fargate mining cases, Dec 2023–Jan 2024

1 · Leaked key

2 Contained3 on other clouds

2 · Fargate clusters in 17 regions

3 Contained1 Not covered6 on other clouds

3 · Administrator user and console

5 Contained6 on other clouds

4 · Data, SSH, a new region and more users

8 Contained12 on other clouds

Key facts

  • Datadog saw the activity in December 2023 and January 2024, from a cluster of Indonesian addresses, most with a history of residential proxy activity, and said a leaked IAM user access key was the cause most of the time
  • In case 2 the actor created ECS clusters, Fargate task definitions of 16384 CPU units and 32768 MiB, and services of 25 tasks with public IPs in under two minutes, in no fewer than 17 regions
  • Datadog estimated hundreds of clusters and tasks and likely thousands of running containers, from 40 Docker Hub images that download XMRig and mine to a NiceHash pool; most images had 20,000 to 100,000 pulls
  • In case 1 the attacker created an IAM user with AdministratorAccess and a console login profile within 11 seconds, likely by automation, and signed in to the console with it a few hours later
  • From the console the attacker downloaded objects from several S3 buckets and pushed SSH keys to EC2 instances through EC2 Instance Connect; whether any instance was reachable is not stated
  • A RunInstances call for two r6i.metal instances in us-west-1, a Region the account did not use, failed a Region verification check; the attacker then created two more administrator users with access keys

Sources

Every fact in this breakdown comes from the public reporting below. The replay is a model of that reporting, not a reconstruction of the environment it describes.

  1. 1.
    Tales from the cloud trenches: Amazon ECS is the new EC2 for crypto miningDatadog Security Labs · Jan 19, 2024 · ResearchEntry vector, case 1 IAM persistence, console sign-in, S3 reads, EC2 Instance Connect, region attempt, case 2 ECS cluster and service creation, container images, mining, region count, recommendations
  2. 2.
    Datadog Report Surfaces Pair of Sophisticated AWS AttacksSecurity Boulevard · Jan 29, 2024 · NewsRe-report of both activities, Datadog commentary on automation and cost

The estate in the replay is illustrative and drawn at the level of attack stages; the victim's real environment is not public. Verdicts describe what a control does when it is in place before the incident. They are not an assessment of the victim's security program.

More cloud attack breakdowns

All breakdowns