Description
AWS IAM users can access AWS resources using different types of credentials, such as passwords or access keys. It is recommended that all credentials that have been unused in 45 or greater days be deactivated or removed.
Rationaleโ
Disabling or removing unnecessary credentials will reduce the window of opportunity for credentials associated with a compromised or abandoned account to be used.
Auditโ
Perform the following to determine if unused credentials exist:
From Consoleโ
- Login to the AWS Management Console.
- Click
Services. - Click
IAM. - Click on
Users. - Click the
Settings(gear) icon. - Select
Console last sign-in,Access key last used, andAccess Key Id. - Click on
Close. - Check and ensure that
Console last sign-inis less than 45 days ago.
Note: Never means the user has never logged in.
- Check and ensure that
Access key ageis less than45days and thatAccess key last useddoes not sayNone.
If the user hasn't signed into the Console in the last 45 days or Access keys are over 45 days old refer to the remediation.
From Command Lineโ
Download Credential Reportโ
- Run the following commands:
aws iam generate-credential-report
aws iam get-credential-report --query 'Content' --output text | base64 -d | cut -d, -f1,4,5,6,9,10,11,14,15,16 | grep -v '^<root_account>'
Ensure unused credentials do not existโ
- For each user having
password_enabledset toTRUE, ensurepassword_last_used_dateis less than45days ago.
- When
password_enabledis set toTRUEandpassword_last_usedis set toNo_Information, ensurepassword_last_changedis less than45days ago.
- For each user having an
access_key_1_activeoraccess_key_2_activetoTRUE, ensure the correspondingaccess_key_n_last_used_dateis less than45days ago.
- When a user having an
access_key_x_active(where x is 1 or 2) toTRUEand correspondingaccess_key_x_last_used_dateis set toN/A, ensureaccess_key_x_last_rotatedis less than45days ago.
Referencesโ
- CCE-78900-8
- https://docs.aws.amazon.com/IAM/latest/UserGuide/best-practices.html#remove-credentials
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_finding-unused.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_passwords_admin-change-user.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_access-keys.html
Additional Informationโ
root_account is excluded in the audit since the root account should not be used for day to day business and would likely be unused for more than 45 days.