Unauthorized Access to Sensitive Files in AWS S3
This detection brief addresses the risk of unauthorized access to sensitive credential and secret files stored in AWS S3 buckets, a common tactic for credential harvesting and lateral movement.
What's new
Attackers frequently target cloud storage environments to harvest sensitive files that facilitate lateral movement and persistence. AWS S3 buckets are often misconfigured or over-privileged, leading to the exposure of configuration files (e.g., .aws/credentials, .env), SSH keys, and PEM/PuTTY private keys. This threat brief highlights the importance of monitoring S3 Data Events to detect when these high-value assets are accessed via 'GetObject' calls. Defenders should focus on identifying access by non-automation identities, as legitimate CI/CD pipelines and administrative tools may also retrieve these files. Ensuring that S3 Data Events are explicitly enabled in CloudTrail is a prerequisite for observability, as management plane events do not capture individual object access.
Impact
Successful retrieval of these credentials can lead to full compromise of the affected AWS identity, unauthorized access to underlying infrastructure, and potential exfiltration of proprietary data or source code. If the retrieved credentials are reused elsewhere, the impact extends beyond the immediate cloud environment to integrated third-party services and local development machines.
Recommendation
- Enable AWS S3 Data Events in CloudTrail to gain visibility into object-level operations.
- Implement and tune the provided Sigma-compatible detection logic to identify 'GetObject' events targeting sensitive file patterns.
- Audit S3 bucket policies for overly permissive access (e.g., public read or broad IAM permissions).
- Treat all retrieved credential files as compromised; rotate secrets and keys immediately upon detection of unauthorized access.
- Establish a baseline of authorized IAM roles and source IPs for S3 bucket access to reduce false positives from automated CI/CD processes.
Immediate actions
Enable S3 Data Events for critical buckets in CloudTrail.
Threat Hunt
Search for existing GetObject calls on sensitive paths in the last 30 days.
Data: CloudTrail Logs
Mitigations
Rotate all credentials identified as stored in public or over-privileged S3 buckets.
Credential exposure
Detection coverage 3
Detect AWS S3 Credential File Retrieved
mediumDetects S3 GetObject calls targeting common credential and secret files such as .aws/credentials, SSH keys, and .env files.
Detect AWS API Activity from Uncommon S3 Client
lowDetects successful AWS S3 API activity originating from S3 Browser or Cyberduck, which are often used for bulk data exfiltration.
Detect AWS S3 Bucket Enumeration or Brute Force
lowDetects a high volume of 403 AccessDenied errors against a single S3 bucket from a single source, indicating potential enumeration or cost-driven attacks.
Detection queries are available on the platform. Get full rules →