Exfiltration (TA0010)(external, opens in a new tab or window)
text code block:FROM logs-aws.cloudtrail-* METADATA _id, _version, _index | WHERE event.provider == "ecr.amazonaws.com" AND event.action IN ("SetRepositoryPolicy", "PutRegistryPolicy") AND event.outcome == "success" AND (aws.cloudtrail.user_identity.type IS NULL OR aws.cloudtrail.user_identity.type != "AWSService") AND aws.cloudtrail.request_parameters RLIKE """.*\"Effect\": *\"Allow\".*""" AND (aws.cloudtrail.request_parameters RLIKE """.*\"Principal\": *\"\*\".*""" OR aws.cloudtrail.request_parameters RLIKE """.*\"Principal\": *\{ *\"AWS\": *\"\*\".*""") | KEEP _id, _version, _index, @timestamp, aws.*, cloud.*, event.*, source.*, user.*, user_agent.*
Install detection rules in Elastic Security
Detect AWS ECR Repository or Registry Policy Granted Public Access 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(external, opens in a new tab or window).