Account has a CloudWatch Logs metric filter and alarm for root account usage
cloudwatch_log_metric_filter_root_usage
CloudTrail logs in CloudWatch include a metric filter for root account activity ({ $.userIdentity.type = "Root" && $.userIdentity.invokedBy NOT EXISTS && $.eventType != "AwsServiceEvent" }) and a linked CloudWatch alarm that triggers when the filter matches.
Risk
Without alerting on root activity, full-privilege actions can proceed unnoticed, impacting:
- confidentiality via data access/exfiltration
- integrity via policy/config tampering
- availability via deletions or shutdowns Delayed detection increases blast radius and persistence.
prowler aws --checks cloudwatch_log_metric_filter_root_usage
Recommendation
Enable real-time alerts for root activity using a log metric filter and a high-priority alarm with notifications.
Reduce exposure: enforce least privilege, keep root for break-glass with MFA, disable root access keys, and route alerts into incident response for defense in depth.
Remediation
- In the AWS console, open CloudWatch > Logs > Log groups and select the CloudTrail log group
- Go to Metric filters > Create metric filter
- For Filter pattern, enter: { $.userIdentity.type = "Root" && $.userIdentity.invokedBy NOT EXISTS && $.eventType != "AwsServiceEvent" }
- Click Next, set any Filter name, set Metric namespace and Metric name, set Metric value to 1, then Create metric filter
- Select the new metric filter and click Create alarm
- Set Period to 5 minutes, Statistic to Sum, Threshold type Static with value 1, Evaluation periods 1, then Create alarm
Source Code
Resource Type
AwsCloudWatchAlarm
References
- https://docs.aws.amazon.com/awscloudtrail/latest/userguide/cloudwatch-alarms-for-cloudtrail.html
- https://www.trendmicro.com/trendaivisiononecloudriskmanagement/knowledge-base/aws/CloudWatchLogs/root-account-usage-alarm.html
- https://asecure.cloud/a/root_account_login/
- https://support.icompaas.com/support/solutions/articles/62000083624-ensure-a-log-metric-filter-and-alarm-exist-for-usage-of-root-account
- https://www.intelligentdiscovery.io/controls/cloudwatch/cloudwatch-alarm-root-account-usage
- https://aws.amazon.com/blogs/security/how-to-receive-notifications-when-your-aws-accounts-root-access-keys-are-used/
- https://www.tenable.com/audits/items/CIS_Amazon_Web_Services_Foundations_v1.5.0_L1.audit:000adfb028a1475075a6b5d2117f53f4