← All Threat Hunting ReportsThreat Hunting Exercise

Threat Hunting Exercise: Analyzing EC2 Proxy S3 Exfiltration Dataset

Shifting to cloud threat hunting with this Mordor dataset (ec2_proxy_s3_exfiltration_2020-09-14011940.json) - your SOC log skills extend nicely to CloudTrail. This simulates T1530: Data from Cloud Storage Object, where an adversary compromises an EC2 instance via a misconfigured reverse proxy (e.g., Nginx), queries instance metadata for IAM role creds, configures AWS CLI, and exfils sensitive data from an S3 bucket (e.g., "ring.txt" containing mock secrets) to their control.

Step 1: Hypothesis Formation

Hypothesis: Adversary leverages a compromised EC2 instance (i-0317f6c6b66ae9c40) with an over-privileged IAM role (MordorNginxStack-BankingWAFRole) to access S3 bucket "mordors3stack-s3bucket-llp2yingx64a" via AWS CLI, listing objects and downloading "ring.txt" (~89 bytes). Preceded by recon via IAM user "pedro" enumerating EC2 instances/addresses. Indicators:

Null Hypothesis: Legit admin ops (e.g., dev syncing files). Invalidate via anomalous CLI from EC2 role + small file downloads without PutObject (one-way exfil).

Rationale: Mordor atomic maps to T1530 (data theft from S3) + T1078.004 (valid cloud accounts via role abuse). Filename highlights EC2 as proxy for stealthy S3 access.

Step 2: Data Sources and Scope

Step 3: Key Findings

Parsed ~10+ visible events (full ~100 truncated). Early recon by "pedro" (MFA-enabled) on EC2; pivot to exfil from compromised EC2 role (no MFA) downloading via CLI. "ring.txt" likely contains exfil data (e.g., creds/hashes).

Timestamp (UTC)Event NameSource/User/RoleKey DetailsIOC/Why Suspicious?
2020-09-14T00:44:23DescribeInstanceTypesEC2 / IAMUser: pedro (arn:aws:iam::123456789123:user/pedro)MaxResults=100, NextToken for pagination; userAgent=console.ec2.amazonaws.com; IP=1.2.3.4.Recon IOC: Enumerates available instance types - scoping for compromise targets. MFA true, but external IP.
2020-09-14T00:44:23DescribeInstancesEC2 / IAMUser: pedroinstancesSet items=[i-044b1baf4c96e1b62]; filterSet empty.Targets specific instance - potential pivot for proxy setup.
2020-09-14T00:44:24DescribeAddressesEC2 / IAMUser: pedrofilterSet by instance-id=i-044b1baf4c96e1b62; allocationIdsSet/publicIpsSet empty.Maps EIPs to instance - enables proxy/routing for exfil.
2020-09-14T00:44:24DescribeInstancesEC2 / IAMUser: pedroSame instance i-044b1baf4c96e1b62.Duplicate query - iterative recon.
(Truncated ~00:48)ModifyInstanceAttribute?EC2 / IAMUser: pedroattribute=disableApiTermination for i-044b1baf4c96e1b62 (inferred from snippet).Hardens instance against termination - persistence post-compromise.
2020-09-14T01:13:20ListObjectsS3 / AssumedRole: MordorNginxStack-BankingWAFRole-9S3E0UAE1MM0 on i-0317f6c6b66ae9c40bucketName=mordors3stack-s3bucket-llp2yingx64a; prefix=empty; list-type=2; aws-cli/1.18.136; bytesOut=500.Exfil IOC: Lists bucket contents from EC2 role (ec2RoleDelivery=1.0) - abuses proxy for S3 enum. No MFA.
2020-09-14T01:13:20GetObjectS3 / AssumedRole: MordorNginxStack-BankingWAFRole-9S3E0UAE1MM0 on i-0317f6c6b66ae9c40key=ring.txt; aws-cli; bytesOut=89; Cipher=ECDHE-RSA-AES128-GCM-SHA256.Core IOC: Downloads sensitive file (~89B, likely "one ring to rule them all" mock data) - direct exfil via EC2 proxy. Consistent IP.

Validation:

Step 4: Recommendations & Next Steps

Hypothesis confirmed - S3 data theft via EC2 proxy! Cloud logs are gold for this.