Do not setup access keys during initial user setup for all IAM users that have a console password
AWS console defaults to no check boxes selected when creating a new IAM user. When cerating the IAM User credentials you have to determine what type of access they require. Programmatic access: The IAM user might need to make API calls, use the AWS CLI, or use the Tools for Windows PowerShell. In that case, create an access key (access key ID and a secret access key) for that user. AWS Management Console access: If the user needs to access the AWS Management Console, create a password for the user. Requiring the additional steps be taken by the user for programmatic access after their profile has been created will give a stronger indication of intent that access keys are [a] necessary for their work and [b] once the access key is established on an account that the keys may be in use somewhere in the organization. Note: Even if it is known the user will need access keys, require them to create the keys themselves or put in a support ticket to have them created as a separate step from user creation.
Risk Level: Low
Cloud Entity: IAM User
CloudGuard Rule ID: D9.AWS.IAM.79
Covered by Spectral: No
Category: Security, Identity, & Compliance
GSL LOGIC
IamUser where passwordEnabled = 'true' should not have createDate dateDifference(firstAccessKey.lastRotated, 'seconds') < 60
REMEDIATION
From Portal
Perform the following to delete access keys that do not pass the audit:
- Login to the AWS Management Console: https://console.aws.amazon.com/iam/
- Click Services
- Click IAM
- Click on Users
- Click on Security Credentials
- As an Administrator
- Click on the X (Delete) for keys that were created at the same time as the user profile but have not been used.
- As an IAM User
- Click on the X (Delete) for keys that were created at the same time as the user profile but have not been used.
From TF
To delete an IAM user access key, delete the following resource:
resource "aws_iam_access_key" "example_access_key" {
..
user = "USER-NAME"
..
}
From Command Line
To delete an IAM user access key, run:
aws iam delete-access-key --access-key-id ACCESS_KEY_ID --user-name USER_NAME
References
- https://docs.aws.amazon.com/cli/latest/reference/iam/delete-access-key.html
- https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html
IAM User
An IAM user is an entity that you create in AWS to represent the person or service that uses it to interact with AWS. A user in AWS consists of a name and credentials.
Compliance Frameworks
- AWS CIS Foundations v. 1.1.0
- AWS CIS Foundations v. 1.2.0
- AWS CIS Foundations v. 1.3.0
- AWS CIS Foundations v. 1.4.0
- AWS CIS Foundations v. 1.5.0
- AWS CIS Foundations v. 2.0.0
- AWS CloudGuard Best Practices
- AWS CloudGuard SOC2 based on AICPA TSC 2017
- AWS HITRUST v11.0.0
- AWS ISO27001:2022
- AWS MITRE ATT&CK Framework v11.3
- AWS NIST 800-53 Rev 5
- AWS Security Risk Management
- CloudGuard AWS All Rules Ruleset
Updated over 1 year ago