Back to Checks
A log monitoring and alert is set up for usage of root account
sls_root_account_usage_alert_enabled
Service: slsSeverity: medium
OfficialBuilt-inVerified
Categories:logging
Resource Type:ALIYUN::SLS::Alert
Alibaba Cloud SLS should have an alarm configured for root account login attempts. By directing ActionTrail logs to SLS with alert rules, usage of the fully privileged root account is detected promptly, supporting least privilege and enabling timely review of root-level operations.
Risk
Without monitoring for root account usage, activities by the most privileged account may go unnoticed. The root account has unrestricted access to all resources, making it a high-value target. Failure to detect unauthorized usage increases risk of account takeover, data destruction, and irreversible changes compromising confidentiality, integrity, and availability.
Run this check with Prowler
Run in Prowler CloudRun
prowler alibabacloud --checks sls_root_account_usage_alert_enabledRecommendation
- Log on to the SLS Console
- Ensure ActionTrail is enabled
- Select Alerts
- Ensure alert rule has been enabled for root account usage
Remediation
CLI
aliyun sls create-alert --project <project-name> --alert-name root-account-usage --alert-displayname 'Root Account Usage Alert' --condition 'event.userIdentity.type: root-account' --dashboard <dashboard-name> --schedule '{"type":"FixedRate","interval":"1m"}'Other
1Log on to the **SLS Console**.
2Ensure **ActionTrail** is enabled and delivering logs to a **Log Service** project.
3Navigate to the project receiving ActionTrail logs.
4Select **Alerts** and click **Create Alert Rule**.
5Configure the query to filter for root account usage: `event.userIdentity.type: root-account`.
6Set the alert **schedule**, **notification method**, and **severity**.
7Save and enable the alert rule.
Check Code
from prowler.lib.check.models import Check, CheckReportAlibabaCloud
from prowler.providers.alibabacloud.services.sls.sls_client import sls_client
class sls_root_account_usage_alert_enabled(Check):
def execute(self) -> list[CheckReportAlibabaCloud]:
findings = []
found = False
for alert in sls_client.alerts:
query_list = alert.configuration.get("queryList", [])
if not query_list:
continue
for query_obj in query_list:
query = query_obj.get("query", "")
if (
"ConsoleSignin" in query
and "event.userIdentity.type" in query
and "root-account" in query
):
found = True
report = CheckReportAlibabaCloud(
metadata=self.metadata(), resource=alert
)
report.status = "PASS"
report.status_extended = (
f"SLS Alert {alert.name} is configured for root account usage."
)
report.resource_id = alert.name
report.resource_arn = alert.arn
report.region = alert.region
findings.append(report)
break
if found:
break
if not found:
report = CheckReportAlibabaCloud(
metadata=self.metadata(), resource=sls_client.provider.identity
)
report.status = "FAIL"
report.status_extended = "No SLS Alert configured for root account usage."
report.resource_id = sls_client.audited_account
report.resource_arn = sls_client.provider.identity.identity_arn
report.region = sls_client.region
findings.append(report)
return findings