How to Detect Use of AWS Account Root User Credentials
The root account has unrestricted access to all resources in the AWS account. It is highly recommended that the use of this account be avoided.
info
This security check is part of the CIS Amazon Web Services Benchmarks and is rated severity critical.
Prerequisites​
This guide assumes that you have already installed and configured Fix Inventory to collect your AWS resources.
Directions​
-
Execute the following
search
command in Fix Inventory Shell:> search is(aws_root_user) {access_keys[]: --> is(access_key)} password_last_used>{{last_access_younger_than.ago}} or access_keys[*].reported.access_key_last_used.last_used>{{last_access_younger_than.ago}}
​kind=aws_root_user, ..., region=fixinventory-poweruser
​kind=aws_root_user, ..., account=poweruser-team -
Pipe the
search
command into thedump
command:> search is(aws_root_user) {access_keys[]: --> is(access_key)} password_last_used>{{last_access_younger_than.ago}} or access_keys[*].reported.access_key_last_used.last_used>{{last_access_younger_than.ago}} | dump
​reported:
​ id: /aws/iam/123
​ name: some-name
​ ctime: '2022-12-05T22:53:14Z'
​ kind: aws_root_user
​ age: 2mo28dThe command output will list the details of all non-compliant
aws_root_user
resources.
Remediation​
- Ensure IAM policies are attached only to groups or roles.
note
Please refer to the AWS IAM documentation for details.