RDS instance does not allow public access in the IP whitelist
Alibaba Cloud RDS instances should only accept connections from trusted networks and IP addresses. This check verifies that the IP whitelist does not contain entries such as 0.0.0.0/0 or 0.0.0.0 that would allow access from anywhere on the internet. Only specific, trusted IP addresses should be whitelisted to minimize the attack surface of the database server.
Risk
Allowing public access (0.0.0.0/0) to the database significantly increases the risk of brute-force attacks, unauthorized access, and data exfiltration. Databases exposed to the internet are prime targets for attackers, and a successful breach can compromise confidentiality, integrity, and availability of all stored data.
Run this check with Prowler
Run in Prowler Cloudprowler alibabacloud --checks rds_instance_no_public_access_whitelistRecommendation
Restrict the RDS IP whitelist to only trusted IP addresses. Remove any entries that allow unrestricted access such as 0.0.0.0/0.
Remediation
CLI
aliyun rds ModifySecurityIps --DBInstanceId <instance_id> --SecurityIps <trusted_ip_list>Other
Check Code
from prowler.lib.check.models import Check, CheckReportAlibabaCloud
from prowler.providers.alibabacloud.services.rds.rds_client import rds_client
class rds_instance_no_public_access_whitelist(Check):
"""Check if RDS Instances are not open to the world."""
def execute(self) -> list[CheckReportAlibabaCloud]:
findings = []
for instance in rds_client.instances:
report = CheckReportAlibabaCloud(
metadata=self.metadata(), resource=instance
)
report.region = instance.region
report.resource_id = instance.id
report.resource_arn = f"acs:rds:{instance.region}:{rds_client.audited_account}:dbinstance/{instance.id}"
is_public = False
for ip in instance.security_ips:
if ip == "0.0.0.0/0" or ip == "0.0.0.0":
is_public = True
break
if not is_public:
report.status = "PASS"
report.status_extended = (
f"RDS Instance {instance.name} is not open to the world."
)
else:
report.status = "FAIL"
report.status_extended = f"RDS Instance {instance.name} is open to the world (0.0.0.0/0 allowed)."
findings.append(report)
return findings