Elastic medium stable kql
AWS S3 Credential File Retrieved from Bucket
Detects successful S3 GetObject calls targeting high-value credential and secret files commonly stored in S3 buckets: AWS credentials files (".aws/credentials", ".aws/config"), SSH private keys ("id_rsa", "id_ed25519", "id_ecdsa", "id_dsa"), environment files (".env"), PEM and PuTTY key files, and other private key patterns. These file types are high-yield targets for credential harvesting from S3. The rule excludes AWSService identity type to suppress S3 replication, Glacier restore, and other AWS-internal data movement that legitimately reads these files.
Detection Logic
data_stream.dataset: "aws.cloudtrail" and
event.provider: "s3.amazonaws.com" and
event.action: "GetObject" and
event.outcome: "success" and
aws.cloudtrail.flattened.request_parameters.key: (
*/.aws/credentials or
*/.aws/config or
*/id_rsa or
*/id_ed25519 or
*/id_ecdsa or
*/id_dsa or
*/.env or
*/.env.* or
*.ppk or
*.pem or
*.key or
*private_key* or
*/.ssh/authorized_keys
) and
not aws.cloudtrail.user_identity.type: "AWSService" False Positives
- ⚠ Legitimate CI/CD pipelines, infrastructure tooling, or configuration management systems may retrieve secret files from S3 as part of their normal operation. Validate the calling identity, user agent, and source IP against known automation accounts and expected access patterns.
Field Validations
Loading…
Comments (0)
Loading comments...