from logs-aws.cloudtrail-*
// any successful uploads via S3 API requests
| where event.dataset == "aws.cloudtrail"
and event.provider == "s3.amazonaws.com"
and event.action == "PutObject"
and event.outcome == "success"
// abstract object name from API request parameters
| dissect aws.cloudtrail.request_parameters "%{?ignore_values}key=%{object_name}}"
// regex on common ransomware note extensions
| where object_name rlike "(.*)(ransom|lock|crypt|enc|readme|how_to_decrypt|decrypt_instructions|recovery|datarescue)(.*)"
and not object_name rlike "(.*)(AWSLogs|CloudTrail|access-logs)(.*)"
// keep relevant fields
| keep tls.client.server_name, aws.cloudtrail.user_identity.arn, object_name
// aggregate by S3 bucket, resource and object name
| stats note_upload_count = count(*) by tls.client.server_name, aws.cloudtrail.user_identity.arn, object_name
// filter for single occurrence to eliminate common upload operations
| where note_upload_count == 1
Install detection rules in Elastic Security
Detect Potential AWS S3 Bucket Ransomware Note Uploaded in the Elastic Security detection engine by installing this rule into your Elastic Stack.
To setup this rule, check out the installation guide for Prebuilt Security Detection Rules(opens in a new tab or window).