In modern cloud environments, a single compromised credential can cascade into a full-scale data breach within minutes. This forensic investigation reconstructs how an external attacker exploited a compromised IAM access key to escalate privileges and exfiltrate sensitive data from an S3 bucket—all in less than an hour.
Executive Summary
On August 26, 2023, the Terrapin CloudWorks AWS account experienced a security breach. An external attacker gained initial access using a compromised IAM access key (AKIARSCCN4A3WD4RO4P4) belonging to the user temp-user. Through privilege escalation via sts:AssumeRole, the attacker assumed the high-privilege AdminRole and successfully exfiltrated a sensitive file named emergency.txt from an S3 bucket.
The Attack Timeline: Minute-by-Minute Reconstruction
Using AWS CloudTrail logs, I reconstructed the complete attack chain from initial reconnaissance to data exfiltration. The attacker followed a methodical progression, adapting their tactics when faced with permission barriers.
Attacker Confirms Compromised Credentials
The attacker makes their first API call from IP 84.32.71.19 to verify the identity of the compromised credentials.
API Call: GetCallerIdentity IAM Identity: temp-user Source IP: 84.32.71.19 Status: Success
Significance: This is the "smoking gun"—the first command executed by the attacker using the compromised access key.
Reconnaissance Meets Resistance
The attacker attempts to discover AWS resources but hits permission barriers.
API Calls Attempted: - ListBuckets - DescribeInstances - [Multiple other enumeration calls] Result: AccessDenied errors Pattern: High volume of failed API calls
Key Finding: The temp-user had limited permissions, prompting the attacker to seek privilege escalation.
The Critical Pivot Point
The attacker successfully exploits the sts:AssumeRole permission to escalate from temp-user to AdminRole.
API Call: sts:AssumeRole From: temp-user (initiator) To: AdminRole (target) MFA Authenticated: false Status: Success
Critical Finding: MFA was not required for role assumption. This single misconfiguration enabled the entire attack.
Identifying the Prize
Now operating as AdminRole, the attacker lists the contents of the emergency-data-recovery S3 bucket from IP 84.32.71.125.
API Call: s3:ListObjects Bucket: emergency-data-recovery IAM Identity: AdminRole (assumed) Source IP: 84.32.71.125
Mission Accomplished
Just 6 seconds after discovery, the attacker downloads emergency.txt from a different IP (84.32.71.3).
API Call: s3:GetObject File: emergency.txt Bucket: emergency-data-recovery Source IP: 84.32.71.3 Time from discovery: 6 seconds
Behavioral Indicator: The IP change suggests distributed infrastructure or proxy chaining to evade detection.
Privilege Escalation: The Smoking Gun
The pivotal moment of this attack was the successful privilege escalation from a low-permission user to an administrative role. The CloudTrail logs reveal critical details:
Before Escalation
- Identity:
temp-user(IAM User) - Permissions: Limited, resulting in multiple
AccessDeniederrors - Capabilities: Insufficient for S3 access to sensitive buckets
After Escalation
- Identity:
AdminRole(Assumed Role) - Permissions: Full administrative access
- MFA Status:
"mfaAuthenticated":"false"⚠️ - Capabilities: Unrestricted access to S3, EC2, IAM, and all services
The AssumeRole API call is the "smoking gun" that explicitly shows temp-user successfully requesting and receiving temporary credentials for AdminRole, fundamentally changing their access level.
Indicators of Compromise (IoCs)
During the investigation, I identified multiple technical and behavioral indicators that can be used for threat hunting and alerting in production environments.
Network Indicators
User Agent Strings
aws-cli/1.27.74 Python/3.10.6 Linux/5.15.90.1-microsoft-standard-WSL2 botocore/1.29.74 aws-sdk-go-v2/1.3.2
IAM Principals Involved
temp-user(Compromised IAM User)AdminRole(Abused IAM Role)
Behavioral Patterns
🚨 High-Volume Failed API Calls
A sudden spike of AccessDenied errors from temp-user between 20:35-20:47 UTC was a clear indicator of malicious reconnaissance. This pattern should trigger immediate alerts.
✅ Escalation After Recon Failure
The successful AssumeRole call occurred immediately after the period of failed discovery attempts—demonstrating adaptive attacker behavior.
AWS Services Accessed
Used for identity confirmation (GetCallerIdentity) and privilege escalation (AssumeRole)
Used for reconnaissance (ListObjects) and data exfiltration (GetObject)
Multiple failed enumeration attempts
Multiple failed DescribeInstances attempts
Prevention Recommendations
Based on the attack chain reconstructed from CloudTrail logs, I developed the following cloud-specific security improvements to prevent similar incidents:
1. Enforce Principle of Least Privilege
The temp-user should not have had the sts:AssumeRole permission for a highly privileged target like AdminRole.
2. Require MFA for Sensitive Actions
The trust policy for AdminRole should require multi-factor authentication for assumption.
3. Implement Access Key Rotation and Auditing
The initial point of failure was a compromised access key.
4. Establish Threat Detection and Alerting
Create automated alerts for high-risk behavioral patterns.
• High count of
AccessDenied errors from one user• Successful
AssumeRole following failed enumeration• S3 access from unusual IP addresses
5. Utilize IP-Based Controls
Restrict API calls to known corporate IP ranges.
aws:SourceIp).
Key Lessons Learned
Defense-in-Depth is Critical: This investigation highlights how a single compromised credential can lead to a significant data breach if multiple layers of security are not implemented. The absence of MFA, overly permissive IAM policies, and lack of behavioral monitoring created a perfect storm for this attack.
The ability to connect seemingly disparate events in CloudTrail logs was essential to reconstructing the full attack narrative. Key takeaways:
- Monitor for Behavioral Anomalies: Failed API calls often precede more severe actions like privilege escalation.
- Time Correlation is Critical: The 48-minute timeline shows how quickly an attacker can move from initial access to data exfiltration.
- MFA is Non-Negotiable: The lack of MFA requirement for
AdminRolewas the single point of failure. - Least Privilege Works: If
temp-usercouldn't assumeAdminRole, the attack would have stopped at reconnaissance.
Technical Skills Demonstrated
📚 Educational Context
This investigation was conducted as part of ENPM665: Cloud Security at the University of Maryland. The attack scenario was created for educational purposes to develop practical skills in cloud forensics, incident response, and AWS security monitoring.