How to Find Unused AWS IAM Access Keys for Users with Configured Passwords
The AWS Console defaults to creating access keys during user setup, resulting in the unnecessary generation of access keys.
In addition to unnecessary credentials, it also generates unnecessary management work in auditing and rotating these keys.
Requiring that additional steps be taken by the user after their profile has been created will give a stronger indication of intent that (a) access keys are necessary for their work and (b) established keys are actually used.
This security check is part of the CIS Amazon Web Services Benchmarks and is rated severity medium.
> search is(aws_iam_access_key) and access_key_status=="Active" and access_key_last_used.last_used==null and /ancestors.aws_iam_user.reported.password_enabled==true
kind=aws_iam_access_key, ..., region=resoto-poweruser
kind=aws_iam_access_key, ..., account=poweruser-team
searchcommand into the
> search is(aws_iam_access_key) and access_key_status=="Active" and access_key_last_used.last_used==null and /ancestors.aws_iam_user.reported.password_enabled==true | dump
The command output will list the details of all non-compliant
- Delete all matching access keys that have been reported.
- Ensure to uncheck the setting that creates access keys by default during the initial user setup.
Please refer to the AWS IAM documentation for details.