Description
Ensure that the AWS account root user is not used for everyday tasks. The last use of the root user is read from the IAM credential report, and the root user is flagged if that use is 1 day old or less in whole days, so a use up to about 48 hours ago is flagged. The password last-used date is used whenever the password has ever been used; the access key last-used dates are only used when the password has never been used, so a recent access key use is not detected if the password was used at any time in the past. Daily administration should be done with IAM roles, IAM Identity Center or IAM users with least-privilege permissions instead.
Rationale
The root user has unrestricted access to every resource and setting in the account, and its permissions cannot be limited by IAM policies. Regular use of the root user increases the chance that its credentials are stolen or misused, which could lead to data exfiltration, tampering with policies and keys, deletion of resources and billing changes. Routine use also makes unusual root activity harder to spot. The root user should be protected with MFA, have no access keys, be monitored with alerts on every sign-in and be used only for the few tasks that require it.
Impact
Reduces the risk of full account compromise through the root credentials
Makes any root activity unusual and easy to detect and investigate
Administrators need IAM roles, IAM Identity Center or IAM users with suitable permissions for daily work
Tasks that can only be performed by the root user are still possible when needed
Default Value
Every AWS account has a root user with a password, created when the account is opened. AWS does not restrict or alert on its use by default.
Pre-Requisites
IAM permissions: iam:GenerateCredentialReport and iam:GetCredentialReport
IAM roles, IAM Identity Center users or IAM users with administrative permissions for daily tasks
Access to the root user credentials and MFA device, held by the people responsible for the account
Test Plan
Console:
Sign in to the AWS Management Console at https://console.aws.amazon.com.
Open the IAM console and select Credential report in the left menu.
Choose Download credentials report and open the CSV file.
In the row for user <root_account>, check the values of password_last_used, access_key_1_last_used_date and access_key_2_last_used_date.
If the last use is 1 day old or less in whole days, based on password_last_used or, only if that value is no_information, on the access key dates, follow the implementation steps.
CLI:
Generate a new credential report:
aws iam generate-credential-report
Download the report (it is returned base64-encoded; decode the saved file to read the CSV):
aws iam get-credential-report --query Content --output text > credential-report.b64
The account fails if the <root_account> row shows a last use that is 1 day old or less in whole days (up to about 48 hours ago). The date in password_last_used is used whenever the password has ever been used; only if it is no_information is access_key_1_last_used_date used, and then access_key_2_last_used_date, so a recent access key use is not detected when the password has been used in the past.
Implementation Steps
Console:
Sign in to the AWS Management Console at https://console.aws.amazon.com.
Make sure that administrators have IAM roles, IAM Identity Center access or IAM users with the permissions they need for daily tasks.
Sign in as the root user, choose the account name at the top right and select Security credentials.
Under Multi-factor authentication (MFA), assign an MFA device if none is assigned.
Under Access keys, delete all root access keys.
Sign out of the root user and use it only for tasks that require root credentials.
Set up an alert on root user sign-ins, for example with an Amazon EventBridge rule or a CloudWatch alarm on CloudTrail events.
Backout Plan
No configuration needs to be reverted. If a task requires the root user:
Sign in to the AWS Management Console at https://console.aws.amazon.com as the root user, using MFA.
Perform only the task that requires root credentials.
Sign out of the root user.
Note: deleted root access keys cannot be restored. Creating new root access keys is not recommended and re-introduces the risk.
Reference
https://docs.aws.amazon.com/IAM/latest/UserGuide/root-user-best-practices.html
https://docs.aws.amazon.com/IAM/latest/UserGuide/root-user-tasks.html
https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_getting-report.html
https://docs.aws.amazon.com/cli/latest/reference/iam/get-credential-report.html