RAM password policy prevents password reuse
Alibaba Cloud RAM password policies can be configured to prevent the reuse of previously used passwords. It is recommended that the password policy prevent the reuse of passwords to ensure users cannot cycle back to previously compromised credentials. This increases account resiliency against brute force logon attempts and reduces the risk of credential reuse attacks.
Risk
Without password reuse prevention, users may cycle back to previously compromised passwords. Attackers with knowledge of old credentials can regain access, threatening the confidentiality and integrity of cloud resources. This weakens the overall security posture of the Alibaba Cloud environment.
Run this check with Prowler
Run in Prowler Cloudprowler alibabacloud --checks ram_password_policy_password_reuse_preventionRecommendation
Configure the RAM password policy to prevent the reuse of at least the last 5 passwords.
Remediation
CLI
aliyun ram SetPasswordPolicy --PasswordReusePrevention 5Terraform
resource "alicloud_ram_password_policy" "example" {
password_reuse_prevention = 5
}Other
Check Code
from prowler.lib.check.models import Check, CheckReportAlibabaCloud
from prowler.providers.alibabacloud.services.ram.ram_client import ram_client
class ram_password_policy_password_reuse_prevention(Check):
"""Check if RAM password policy prevents password reuse."""
def execute(self) -> list[CheckReportAlibabaCloud]:
findings = []
if ram_client.password_policy:
report = CheckReportAlibabaCloud(
metadata=self.metadata(), resource=ram_client.password_policy
)
report.region = ram_client.region
report.resource_id = f"{ram_client.audited_account}-password-policy"
report.resource_arn = (
f"acs:ram::{ram_client.audited_account}:password-policy"
)
if ram_client.password_policy.password_reuse_prevention >= 5:
report.status = "PASS"
report.status_extended = f"RAM password policy prevents password reuse (history: {ram_client.password_policy.password_reuse_prevention} passwords)."
else:
report.status = "FAIL"
if ram_client.password_policy.password_reuse_prevention == 0:
report.status_extended = (
"RAM password policy does not prevent password reuse."
)
else:
report.status_extended = f"RAM password policy prevents reuse of only {ram_client.password_policy.password_reuse_prevention} previous passwords, which is less than the recommended 5."
findings.append(report)
return findings