RDS Instance Publicly Accessible

An Amazon RDS database instance is publicly accessible and its security group admits connections from the internet, exposing the database to password guessing and attack.

SeverityHigh
CVSS 3.18.1 CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H Open in the calculator
CVSS 4.09.2 CVSS:4.0/AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator
CWECWE-668: Exposure of Resource to Wrong Sphere
OWASP Top 10A01:2025 Broken Access Control
MITRE ATT&CKT1110 Brute Force, T1213.006 Databases
CategorySecurity Misconfiguration

Description

An RDS DB instance has PubliclyAccessible set to true. Its DNS endpoint then resolves to a public IP address from outside the VPC, and where the instance's subnets route to an internet gateway and its security group allows the database port from wide ranges such as 0.0.0.0/0, the database listener is reachable from the internet. The same applies to Aurora DB instances.

The listener is then exposed to automated password guessing against the master user and other accounts, to exploitation of vulnerabilities in the database engine, and to denial of service. An attacker who obtains valid credentials, for example from a leaked application configuration file, can read, change or delete all the data the account can reach without needing any foothold in the organisation's network. The risk is higher where the database holds personal or financial data, and lower where the security group admits only specific trusted addresses, IAM database authentication is used and TLS is enforced.

Public access is sometimes enabled deliberately for developers, reporting tools or third parties connecting from outside AWS, and sometimes arises from defaults: when PubliclyAccessible is not specified, RDS makes non-Aurora instances public if no DB subnet group is given, and makes instances public if the subnet group named default is used.

The issue is identified with aws rds describe-db-instances (the PubliclyAccessible attribute and the attached security groups), by resolving the endpoint from outside the VPC, and by scanning for the database port. Prowler, ScoutSuite, Security Hub and the AWS Config rule rds-instance-public-access-check report it.

Remediation

Remove the database from the internet:

  • Set PubliclyAccessible to false (aws rds modify-db-instance --db-instance-identifier "$DB_ID" --no-publicly-accessible --apply-immediately) and place the instance in a DB subnet group made up of private subnets.
  • Restrict the security group to the application tier's security groups and specific administrative sources, never 0.0.0.0/0.
  • Give administrators and external tools access through a VPN, AWS Systems Manager port forwarding through a host in the VPC, or AWS PrivateLink, rather than through public exposure.
  • If the instance has been exposed, rotate the master password and other database credentials, store them in AWS Secrets Manager, and consider IAM database authentication.
  • Enforce TLS for client connections through the instance's parameter group, for example rds.force_ssl for PostgreSQL and SQL Server, or require_secure_transport for MySQL and MariaDB.

Confirm the fix with aws rds describe-db-instances showing PubliclyAccessible as false, and by checking that the endpoint resolves to a private address and that the port cannot be reached from outside.

References


Add This Finding to Your Library

In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.

Free trial  ·  No card required

Only need the reporting? Our reporting tool is free and open source, with the same library.


More AWS Findings

Every AWS finding