How to Find AWS IAM Use of the Root Account
Problem​
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 Resoto to collect your AWS cloud resources.
Directions​
Execute the following
search
command in Resoto Shell or Resoto UI:> 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=resoto-poweruser
​kind=aws_root_user, ..., account=poweruser-teamPipe 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.Fix detected issues by following the remediation steps:
- Follow the remediation instructions.
- Ensure IAM policies are attached only to groups or roles.
notePlease refer to the AWS IAM documentation for details.