Control: 1.7 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.
The 'root user' has unrestricted access to and control over all account resources. Use of it is inconsistent with the principles of least privilege and separation of duties, and can lead to unnecessary harm due to error or account compromise.
Remediation
If you find that the 'root' user account is being used for daily activity to include administrative tasks that do not require the 'root' user:
- Change the 'root' user password.
- Deactivate or delete any access keys associate 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.
Usage
Run the control in your terminal:
powerpipe control run aws_compliance.control.cis_v300_1_7
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run aws_compliance.control.cis_v300_1_7 --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>';