Ensure credentials unused for 45 days or more are disabled
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 for 45 days or more be deactivated or removed.
Rationale
Disabling or removing unused credentials reduces the window of opportunity for credentials associated with a compromised or abandoned account to be used.
Impact
Disabling or removing unused credentials reduces the window of opportunity for credentials associated with a compromised or abandoned account to be used.
Audit Procedure
Using AWS Console
- Sign in to the AWS Management Console and open the IAM console at https://console.aws.amazon.com/iam
- Click on
Users - Click the
Settings(gear) icon - Select
Console last sign-in,Access key last used, andAccess Key Id - Click on
Confirm - Check and ensure that
Console last sign-inis less than 45 days ago.
Note - - means the user has never logged in.
- If credentials have not been used within 45 days, refer to remediation
Using AWS CLI
- Generate and review the credential report:
aws iam generate-credential-report
aws iam get-credential-report --query 'Content' --output text | base64 -d
- Review the following fields:
password_last_usedaccess_key_1_last_used_dateaccess_key_2_last_used_date
- Identify any credentials unused for 45 days or more
Expected Result
All IAM user credentials (passwords and access keys) should show activity within the last 45 days. Any credentials unused for 45 days or more should be disabled or removed.
Remediation
Using AWS Console
Perform the following to deactivate or remove unused credentials:
- Login to the AWS Management Console and open the IAM console
- Click on the
User - Select the user
- Click
Security Credentials
Disable Console Access:
- In the Console sign-in section, select Manage console access
- If Console last sign-in is greater than 45 days, select Disable access
Deactivate or Delete Access Keys:
- In the Access keys section:
- Deactivate unused keys, or
- Delete keys that are no longer required
Using AWS CLI
- Delete unused access keys:
aws iam delete-access-key --access-key-id <access-key-id> --user-name <user-name>
- Remove console access:
aws iam delete-login-profile --user-name <user-name>
Default Value
By default, AWS does not automatically disable or remove IAM user credentials based on age or last use. Console passwords and access keys remain active until manually deactivated or deleted.
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 from this audit, as root usage should be limited and may not occur within a 45-day window- Consider implementing automation (e.g., AWS Config, Lambda, or IAM Access Analyzer) to regularly detect and remediate unused credentials
CIS Controls
| Controls Version | Control | IG 1 | IG 2 | IG 3 |
|---|---|---|---|---|
| v8 | 5.3 Disable Dormant Accounts - Delete or disable any dormant accounts after a period of 45 days of inactivity, where supported. | x | x | x |
| v7 | 16.9 Disable Dormant Accounts - Automatically disable dormant accounts after a set period of inactivity. | x | x | x |
MITRE ATT&CK Mappings
| Techniques / Sub-techniques | Tactics | Mitigations |
|---|---|---|
| T1078.004 | TA0001 | M1018 |
Profile
Level 1 | Automated