Skip to main content
Back
DemonstrationAWS · SaaS
7 min read

EleKtra-Leak in Unit 42's honeypot: an AWS key leaked on GitHub

Environment
Unit 42's HoneyCloud AWS account (staged)
When
Run date not stated; campaign active since December 2020Disclosed Oct 30, 2023
Entry
Unit 42 committed AWS IAM keys in cleartext, in a file of a past commit, to a public GitHub repository on purpose; the EleKtra-Leak actor's automated tools, which continually clone public GitHub repositories, found the keys and used them within five minutes.

Unit 42 committed AWS IAM keys in cleartext to a public GitHub repository of its HoneyCloud honeypot. GitHub secret scanning notified AWS, which quarantined the IAM user within two minutes, and the EleKtra-Leak actor's automation still called DescribeRegions with the key within five minutes of the exposure. Unit 42 then replaced the quarantine with the user's original overly permissive policy, and the actor created security groups and launched c5a.24xlarge instances from private AMIs in several Regions, in more than 400 API calls over seven minutes, to mine Monero.

What the demonstration did

External Parties
Unit 42 researchers
Public GitHub repository
GitHub secret scanning
+ 3 more
Internet
AWS APIleaked IAM user key
EC2 in Every Accessible Region
HoneyCloud AWS Account
Security Groups
Mining Instances
IAM User Key
Quarantine Policy

Replaying the EleKtra-Leak run in Unit 42's honeypot / published October 2023; the run date is not stated

  1. 1

    A key committed on purpose

    Run date not stated; before October 30, 2023

    Unit 42 commits an AWS key in cleartext to a public GitHub repository on purpose, and the EleKtra-Leak actor's tooling, which continually clones public repositories, finds it.

  2. 2

    Quarantine, then the first call

    13:30:22 and 13:34:15; the date and time zone were not stated

    GitHub secret scanning tells AWS, which attaches its quarantine policy to the IAM user; within five minutes of the exposure the actor calls DescribeRegions with the key from the internet.

  3. 3

    Quarantine removed

    Time not stated, after 13:34:15

    To watch the full operation, Unit 42 replaces the quarantine policy with the user's original overly permissive policy; the report says the quarantine would have prevented the attack.

  4. 4

    Mining fleet

    Seven minutes of API calls; the date was not stated

    The actor creates security groups and launches c5a.24xlarge instances from private AMIs in several Regions, in more than 400 API calls over seven minutes, and the instances mine Monero with a miner fetched from Google Drive.

Impact

No victim: in Unit 42's own staged AWS account the actor launched large mining instances in several Regions, in more than 400 API calls over seven minutes, and mined Monero, whose earnings could not be traced; across the campaign Unit 42 counted 474 likely actor-controlled miners between August 30 and October 6, 2023.

Outcome

What the run shows about your AWS keys

A cleartext key in a public repository was used within five minutes. The quarantine AWS attaches stood when the first call came, and Unit 42 says it would have prevented the attack; it is reactive, and it acts only on keys AWS learns about. A service control policy that denies calls by IAM users without MFA refuses a call signed with a long-term IAM user key in a member account of an AWS organization; the sources imply, and do not state, that the leaked key was one, and do not say whether the account sat in an organization, so it bounds such keys and is not shown to refuse these calls. A service control policy that denies detaching the AWS quarantine policies bounds who can remove that quarantine; Unit 42, the account's owner, removed it on purpose. Allowed AMIs, a Region service control policy and VPC Block Public Access would have bounded the fleet; Allowed AMIs and VPC Block Public Access came after the run. GitHub push protection refuses a push that carries the key, unless someone with bypass rights lets it through. No AWS control reaches the repository or a clone of it.

Would the controls have stopped it?

In hindsight, no control would have stopped it. 8 controls would have limited how far it went. 2 steps have 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
8
Contained
2
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
Unit 42 researchers
Public GitHub repository
GitHub secret scanning
+ 3 more
Internet
AWS APIleaked IAM user key
EC2 in Every Accessible Region
HoneyCloud AWS Account
Security Groups
Mining Instances
IAM User Key
Quarantine Policy

Replaying the EleKtra-Leak run in Unit 42's honeypot / published October 2023; the run date is not stated

1 · A key committed on purpose

2 Contained2 Not covered3 on other clouds

2 · Quarantine, then the first call

1 Contained3 on other clouds

3 · Quarantine removed

1 Contained

4 · Mining fleet

4 Contained6 on other clouds

Key facts

  • Unit 42 placed the keys in cleartext in a file of a past commit in a public GitHub repository; keys encoded in Base64 went unfound
  • GitHub secret scanning notified AWS, which attached its quarantine managed policy to the IAM user at 13:30:22, within two minutes of the leak; the date and the time zone were not stated
  • The actor's first call with the key, DescribeRegions, came at 13:34:15, within five minutes of the exposure and while the quarantine stood
  • Unit 42 replaced the quarantine with the user's original overly permissive IAM policy to watch the full operation, and said the quarantine would have prevented the attack
  • The actor created security groups and launched c5a.24xlarge instances from private AMIs in several Regions, in more than 400 API calls over seven minutes; the instances fetched a Monero miner from Google Drive and mined to the SupportXMR pool
  • Between August 30 and October 6, 2023, Unit 42 counted 474 unique miners it treats as likely actor-controlled EC2 instances; the campaign was active from at least December 2020

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.
    CloudKeys in the Air: Tracking Malicious Operations of Exposed IAM KeysUnit 42 (Palo Alto Networks) · Nov 6, 2023 · ResearchHoneyCloud design, leak on GitHub, GitHub secret scanning notice to AWS, quarantine policy and its replacement, timing, API sequence, instance type, AMIs, user data, mining payload, miner count, campaign start, VPN indications, recommendations
  2. 2.
    AWSCompromisedKeyQuarantineV2 (AWS Managed Policy reference)Amazon Web Services · Oct 2, 2024 · AdvisoryQuarantine policy content in its current version, AWS instruction not to remove the policy
  3. 3.
    IAM Credentials in Public GitHub Repositories Harvested in MinutesSecurityWeek · Oct 31, 2023 · NewsCampaign summary, report date, Monero earnings that could not be traced

The estate in the replay follows the researchers' description of their own test environment. Verdicts describe what a control does when it is in place before the run. They are not an assessment of any company's security program.

More cloud attack breakdowns

All breakdowns