No root account access key exists
Alibaba Cloud RAM access keys provide programmatic access to an account. The root account is the most privileged user and should not have access keys. All root access keys should be removed to limit compromise vectors and encourage role-based accounts following the principle of least privilege.
Risk
The root account has unrestricted access to all resources and services. If its access keys are compromised, an attacker gains full administrative control, including ability to create, modify, or delete any resource. This poses critical risk to the confidentiality, integrity, and availability of all cloud resources and data.
Run this check with Prowler
Run in Prowler Cloudprowler alibabacloud --checks ram_no_root_access_keyRecommendation
Remove all access keys associated with the root account to reduce the attack surface and encourage the use of role-based accounts with least privilege.
Remediation
CLI
aliyun ram DeleteAccessKey --UserAccessKeyId <access_key_ID>Other
Check Code
from prowler.lib.check.models import Check, CheckReportAlibabaCloud
from prowler.providers.alibabacloud.services.ram.ram_client import ram_client
class ram_no_root_access_key(Check):
"""Check if root account has no access keys."""
def execute(self) -> list[CheckReportAlibabaCloud]:
findings = []
report = CheckReportAlibabaCloud(metadata=self.metadata(), resource={})
report.region = ram_client.region
report.resource_id = "<root_account>"
report.resource_arn = f"acs:ram::{ram_client.audited_account}:root"
# Check if we're authenticated as root account
# Use the is_root flag from identity (set via STS GetCallerIdentity)
is_root = ram_client.provider.identity.is_root
if not is_root:
# If authenticated as RAM user, we can't verify root account access keys
report.status = "MANUAL"
report.status_extended = "Cannot verify root account access keys: authenticated as RAM user. This check requires root account credentials."
elif ram_client.root_access_keys:
report.status = "FAIL"
report.status_extended = "Root account has access keys."
else:
report.status = "PASS"
report.status_extended = "Root account does not have access keys."
findings.append(report)
return findings