CreateUser
Event Information
- The CreateUser event in AWS for IAM refers to the action of creating a new user in the Identity and Access Management (IAM) service.
- This event signifies the initiation of a new user account creation process within the AWS account.
- The CreateUser event is typically triggered when an administrator or a user with appropriate permissions executes the necessary API or CLI command to create a new IAM user.
Examples
-
Weak password policy: If the CreateUser operation in AWS IAM allows users to set weak passwords without enforcing any complexity requirements, it can lead to security vulnerabilities. Attackers may easily guess or brute-force weak passwords, compromising the security of user accounts.
-
Lack of multi-factor authentication (MFA): If the CreateUser operation does not enforce the use of MFA for IAM users, it increases the risk of unauthorized access. MFA adds an extra layer of security by requiring users to provide an additional authentication factor, such as a one-time password generated by a mobile app or a hardware token.
-
Insufficient permissions management: If the CreateUser operation allows users to create IAM users with excessive permissions, it can lead to privilege escalation and unauthorized access to sensitive resources. It is important to ensure that users are granted only the necessary permissions based on the principle of least privilege.
Remediation
Using Console
-
Example 1: Enforce strong password policy for IAM users
- Step 1: Login to the AWS Management Console.
- Step 2: Go to the IAM service.
- Step 3: Click on “Account settings” in the left navigation pane.
- Step 4: Under the “Password policy” section, click on “Edit”.
- Step 5: Configure the password policy settings according to your requirements, such as minimum password length, password complexity requirements, and password expiration.
- Step 6: Click on “Apply password policy” to save the changes.
-
Example 2: Enable multi-factor authentication (MFA) for IAM users
- Step 1: Login to the AWS Management Console.
- Step 2: Go to the IAM service.
- Step 3: Click on “Users” in the left navigation pane.
- Step 4: Select the IAM user for which you want to enable MFA.
- Step 5: Click on the “Security credentials” tab.
- Step 6: Under the “Multi-factor authentication (MFA)” section, click on “Manage MFA”.
- Step 7: Follow the on-screen instructions to set up MFA for the user, either by using a virtual MFA device or a hardware MFA device.
-
Example 3: Enable AWS CloudTrail for logging IAM events
- Step 1: Login to the AWS Management Console.
- Step 2: Go to the CloudTrail service.
- Step 3: Click on “Trails” in the left navigation pane.
- Step 4: Click on “Create trail”.
- Step 5: Provide a name for the trail and choose the S3 bucket where the CloudTrail logs will be stored.
- Step 6: Under the “Management events” section, enable logging for IAM events.
- Step 7: Configure any additional settings as required, such as log file encryption and log file validation.
- Step 8: Click on “Create” to create the trail and start logging IAM events.
Using CLI
-
Ensure IAM users have strong passwords:
- Use the
update-login-profile
command to set a strong password for an IAM user:
- Use the
-
Enable multi-factor authentication (MFA) for IAM users:
- Use the
enable-mfa-device
command to enable MFA for an IAM user:
- Use the
-
Remove unnecessary IAM access keys:
- Use the
delete-access-key
command to delete an IAM access key:
- Use the
Using Python
- Ensure IAM users have strong passwords:
- Use the
boto3
library in Python to retrieve a list of IAM users. - For each user, check if their password policy meets the desired criteria (e.g., minimum length, complexity requirements).
- If a user’s password policy does not meet the criteria, use the
update_account_password_policy
method to update the policy accordingly.
- Use the
- Monitor and log IAM user activities:
- Use the
boto3
library in Python to enable CloudTrail for the AWS account. - Create a CloudTrail trail and specify the desired settings, such as the S3 bucket to store the logs.
- Enable logging for IAM events by configuring the trail to capture IAM-related events.
- Use the
start_logging
method to start logging IAM events.
- Use the
- Regularly rotate access keys for IAM users:
- Use the
boto3
library in Python to retrieve a list of IAM users. - For each user, use the
list_access_keys
method to retrieve their access keys. - Generate new access keys for each user using the
create_access_key
method. - Use the
update_access_key
method to deactivate the old access keys and activate the new ones.
- Use the