Massive AWS Attack Compromises 230 Million Cloud Endpoints by Exploiting Exposed .env Files for Credential Theft

230 Million AWS Endpoints Compromised in Attack Exploiting Exposed .env Files

CRITICAL
June 7, 2026
7m read
Cloud SecurityData BreachCyberattack

Impact Scope

People Affected

230 million cloud endpoints

Industries Affected

TechnologyOther

Related Entities

Products & Tech

Full Report

Executive Summary

A large-scale, automated attack campaign has resulted in the compromise of an estimated 230 million unique cloud endpoints hosted on Amazon Web Services (AWS). The attackers' primary initial access vector was the exploitation of a simple but widespread misconfiguration: publicly exposed environment (.env) files. These files, often containing plaintext credentials such as API keys and database passwords, were systematically harvested by the attackers. Once inside a victim's AWS account, the threat actors escalated privileges, deployed malicious AWS Lambda functions to expand their operation, and ultimately exfiltrated massive amounts of data to their own Amazon S3 buckets before leaving ransom notes. The incident is a stark reminder of the critical importance of basic security hygiene and the devastating consequences of leaking credentials in a cloud environment.


Threat Overview

The campaign was notable for its scale and automation. The threat actors operated by scanning millions of domains for accessible .env files. These configuration files are commonly used in web development to store environment-specific variables, and due to developer error, are frequently left on web servers where they can be accessed by the public.

The attackers were particularly interested in credentials for services like Mailgun, likely to use them for follow-on phishing campaigns, but the primary goal was the compromise of AWS accounts. The attack's success hinges on the high value of the credentials typically stored in .env files, which can provide a direct, authenticated entry point into an organization's most sensitive cloud infrastructure.


Technical Analysis

The attack followed a clear, multi-stage methodology:

  1. Reconnaissance: Attackers used automated scanners to crawl the web, sending HTTP requests for /.env on over 110,000 domains (T1595.002).
  2. Initial Access: When a scanner found a publicly exposed .env file, the contents, including AWS API keys (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY), were harvested (T1552.001).
  3. Discovery: Using the stolen AWS credentials, attackers made API calls (e.g., ListBuckets, ListRoles, ListFunctions) to map out the victim's cloud environment and identify valuable data assets.
  4. Privilege Escalation: The attackers created new IAM roles with full administrative privileges (AdministratorAccess) to ensure persistent and unrestricted access to the account, even if the original stolen key was revoked (T1078.004).
  5. Persistence and Propagation: Malicious AWS Lambda functions were deployed. These serverless functions were programmed to continue scanning for more credentials from within the compromised AWS environment, effectively using the victim's own infrastructure to fuel the attack's expansion.
  6. Exfiltration: The primary goal was data theft. Attackers used their escalated privileges to copy data from the victim's S3 buckets to S3 buckets under their own control (T1537).
  7. Impact: After exfiltrating the data, the attackers deleted the data from the victim's buckets and uploaded ransom notes, completing the double-extortion cycle (T1485).

MITRE ATT&CK Mapping

Tactic
Reconnaissance
Technique ID
T1595.002
Technique Name
Active Scanning: Vulnerability Scanning
Description
Attackers scanned millions of domains for exposed .env files.
Tactic
Credential Access
Technique ID
T1552.001
Technique Name
Credentials In Files
Description
The core of the attack: harvesting plaintext credentials from .env files.
Tactic
Initial Access
Technique ID
T1078.004
Technique Name
Valid Accounts: Cloud Accounts
Description
Attackers used the stolen AWS API keys to gain initial access.
Tactic
Privilege Escalation
Technique ID
T1098.004
Technique Name
Manipulate Account: Create or Modify Cloud Account
Description
Attackers created new IAM roles with administrator privileges.
Tactic
Persistence
Technique ID
T1053.005
Technique Name
Scheduled Task/Job: Serverless Function
Description
Malicious AWS Lambda functions were deployed for persistence and to continue scanning.
Tactic
Exfiltration
Technique ID
T1537
Technique Name
Transfer Data to Cloud Account
Description
Data was copied from victim S3 buckets to attacker-controlled S3 buckets.
Tactic
Impact
Technique ID
T1485
Technique Name
Data Destruction
Description
Attackers deleted data from victim buckets after exfiltration.

Impact Assessment

The impact of this attack is devastating for the victims. It represents a complete compromise of their cloud environment, leading to a massive data breach, operational disruption from data deletion, and a direct financial demand via ransom. The recovery costs, including forensic investigation, data restoration (if possible), regulatory fines, customer notification, and reputational damage, will be immense. This incident serves as a powerful case study on how a simple misconfiguration—an exposed .env file—can cascade into a catastrophic security failure in the cloud.


IOCs — Directly from Articles

No specific IOCs were provided in the source articles.


Cyber Observables — Hunting Hints

AWS administrators should hunt for the following signs of compromise:

Type
log_source
Value
AWS CloudTrail
Description
The primary log source for hunting. Look for suspicious API calls like CreateRole, PutRolePolicy, CreateFunction.
Context
SIEM, AWS GuardDuty, CloudTrail Insights
Type
user_agent
Value
(unusual user agent)
Description
Attackers' automated scripts may use a common or unusual user agent for their API calls. Look for API access from non-SDK sources.
Context
AWS CloudTrail Logs
Type
api_endpoint
Value
s3:CopyObject
Description
Monitor for large numbers of CopyObject calls, especially to S3 buckets outside your organization.
Context
AWS CloudTrail, S3 Access Logs
Type
string_pattern
Value
AdministratorAccess
Description
Alert on the creation of any new IAM role or policy that grants AdministratorAccess or similarly broad permissions.
Context
AWS CloudTrail, AWS Config

Detection & Response

Detection:

  1. AWS GuardDuty: This is AWS's native threat detection service. It is designed to detect many of the activities described in this attack, such as anomalous API activity, unusual S3 access patterns, and reconnaissance from known malicious IPs.
  2. CloudTrail Analysis: Ingest CloudTrail logs into a SIEM and create high-priority alerts for the creation of new admin roles, changes to IAM policies, and the creation of Lambda functions by unexpected users or roles.
  3. S3 Access Logging: Enable server access logging for all critical S3 buckets. Monitor for GetObject or CopyObject requests from unauthorized or unexpected principals or IP addresses.
  4. Cloud Service Monitoring: Continuously monitor for public S3 buckets and other exposed resources using AWS Trusted Advisor or third-party Cloud Security Posture Management (CSPM) tools.

Response:

  1. Containment: If a compromise is detected, immediately revoke the stolen credentials and disable the malicious IAM roles created by the attacker.
  2. Eradication: Delete the malicious Lambda functions and any other resources created by the attacker.
  3. Forensic Analysis: Use CloudTrail logs to conduct a full investigation, determining the scope of the breach, what data was exfiltrated, and the full timeline of attacker activity.

Mitigation

Strategic Mitigation:

  • Credential Management: The most critical mitigation is to never hardcode credentials in files like .env. Use a dedicated secrets management service like AWS Secrets Manager or HashiCorp Vault. These services provide secure storage and programmatic, audited access to secrets at runtime.
  • Cloud Configuration Hardening: Use CSPM tools to continuously scan your cloud environment for misconfigurations like publicly accessible S3 buckets or exposed .env files on web servers.
  • Principle of Least Privilege: Ensure that IAM roles and policies are narrowly scoped. An API key should only have the exact permissions needed for its function, not broad administrative access.

Tactical Mitigation:

  1. Web Server Configuration: Configure your web server (e.g., Nginx, Apache) to block all external access to . (dot) files, especially .env.
  2. Git Configuration: Use a .gitignore file to ensure that .env and other configuration files containing secrets are never committed to a source code repository.
  3. IAM Best Practices: Enable MFA for all IAM users, especially privileged ones. Use temporary credentials via IAM roles wherever possible, instead of long-lived API keys.

Timeline of Events

1
June 7, 2026
This article was published

MITRE ATT&CK Mitigations

Avoid hardcoding credentials. Use a dedicated secrets management service like AWS Secrets Manager to handle sensitive information.

Properly configure web servers to prevent directory listing and block access to sensitive files like .env. Use CSPM tools to detect misconfigurations.

Enforce the principle of least privilege for all IAM roles and users. An API key should never have broader permissions than necessary.

Enable and continuously monitor AWS CloudTrail and other logs to detect anomalous API activity and policy changes.

Article Author

Jason Gomes

Jason Gomes

• Cybersecurity Practitioner

Cybersecurity professional with over 10 years of specialized experience in security operations, threat intelligence, incident response, and security automation. Expertise spans SOAR/XSOAR orchestration, threat intelligence platforms, SIEM/UEBA analytics, and building cyber fusion centers. Background includes technical enablement, solution architecture for enterprise and government clients, and implementing security automation workflows across IR, TIP, and SOC use cases.

Threat Intelligence & AnalysisSecurity Orchestration (SOAR/XSOAR)Incident Response & Digital ForensicsSecurity Operations Center (SOC)SIEM & Security AnalyticsCyber Fusion & Threat SharingSecurity Automation & IntegrationManaged Detection & Response (MDR)

Tags

AWScloud security.env filedata breachcredential theftIAMS3Lambda

📢 Share This Article

Help others stay informed about cybersecurity threats

🎯 MITRE ATT&CK Mapped

Every tactic, technique, and sub-technique used in this threat has been identified and mapped to the MITRE ATT&CK framework for consistent, actionable threat language.

🧠 Enriched & Analyzed

Observables and indicators of compromise (IOCs) have been extracted and cataloged. Risk has been assessed and correlated with known threat actors and historical campaigns.

🛡️ Actionable Guidance

Detection rules, incident response steps, and D3FEND-aligned mitigation strategies are included so your team can act on this intelligence immediately.

🔗 STIX Visualizer

Structured threat data is packaged as a STIX 2.1 bundle and can be visualized as an interactive graph — relationships between actors, malware, techniques, and indicators.

Sigma Generator

Sigma detection rules are derived from the threat techniques in this article and can be converted for deployment across any major SIEM or EDR platform.