Skip to main content

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.

info

This security check is part of the CIS Amazon Web Services Benchmarks and is rated severity medium.

Prerequisites

This guide assumes that you have already installed and configured Resoto to collect your AWS resources.

Directions

  1. Execute the following search command in Resoto Shell or Resoto UI:

    > 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
  2. Pipe the search command into the dump command:

    > 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
    ​reported:
    ​ id: /aws/iam/123
    ​ name: some-name
    ​ ctime: '2022-12-05T22:53:14Z'
    ​ kind: aws_iam_access_key
    ​ age: 2mo28d

    The command output will list the details of all non-compliant aws_iam_access_key resources.

Remediation

  • 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.
note

Please refer to the AWS IAM documentation for details.

Further Reading

Contact Us

 

 

 

Some Engineering Inc.