Control: 2.6 Eliminate use of the 'root' user for administrative and daily tasks
Description
With the creation of an AWS account, a 'root user' is created that cannot be disabled or deleted. That user has unrestricted access to and control over all resources in the AWS account. It is highly recommended that the use of this account be avoided for everyday tasks.
Remediation
If you find that the 'root' user account is being used for daily activities, including administrative tasks that do not require the 'root' user:
- Change the 'root' user password.
- Deactivate or delete any access keys associated with the 'root' user
Remember, anyone who has 'root' user credentials for your AWS account has unrestricted access to and control of all the resources in your account, including billing information.
Default Value:
By default, the AWS root user is created with full administrative privileges and no restrictions. The root account remains permanently enabled and can perform all actions in the account unless explicitly limited by using alternative IAM users and roles.
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.cis_v600_2_6
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.cis_v600_2_6 --share
SQL
This control uses a named query:
select user_arn as resource, case when password_last_used >= (current_date - interval '90' day) then 'alarm' when access_key_1_last_used_date <= (current_date - interval '90' day) then 'alarm' when access_key_2_last_used_date <= (current_date - interval '90' day) then 'alarm' else 'ok' end as status, case when password_last_used is null then 'Root never logged in with password.' else 'Root password used ' || to_char(password_last_used , 'DD-Mon-YYYY') || ' (' || extract(day from current_timestamp - password_last_used) || ' days).' end || case when access_key_1_last_used_date is null then ' Access Key 1 never used.' else ' Access Key 1 used ' || to_char(access_key_1_last_used_date , 'DD-Mon-YYYY') || ' (' || extract(day from current_timestamp - access_key_1_last_used_date) || ' days).' end || case when access_key_2_last_used_date is null then ' Access Key 2 never used.' else ' Access Key 2 used ' || to_char(access_key_2_last_used_date , 'DD-Mon-YYYY') || ' (' || extract(day from current_timestamp - access_key_2_last_used_date) || ' days).' end as reason , account_idfrom aws_iam_credential_reportwhere user_name = '<root_account>';