Beginner Lab red team icon   aws

Pillage Exposed RDS Instances

Learn about the danger of publicly accessible Amazon Relational Database Service (RDS) instances, and how this can be leveraged by an attacker!

Overview

We created this beginner-friendly lab to teach about the danger of publicly accessible Amazon Relational Database Service (RDS) instances, and how this can be leveraged by an attacker. Advice on remediation and detection is also included.

Scenario

"In the backdrop of rising cybersecurity threats, with chatter on Telegram channels hinting at data dumps and Pastebin snippets exposing snippets of configurations, Huge Logistics is taking no chances. They've enlisted your team's expertise to rigorously assess their cloud infrastructure. Armed with a list of IP addresses and endpoints, a lead emerged - an RDS endpoint: exposed.cw9ow1llpfvz.eu-north-1.rds.amazonaws.com. Your mission? Dive deep into this endpoint's security, and identify any security issues before threat actors do.
"

Lab prerequisites
  • Basic Linux command line knowledge
Learning outcomes
  • Familiarity with Nmap and the mysql-brute script
  • Familiarity with the MySQL cli
  • An awareness of how this could be remediated and detected
Real-world context

Amazon Relational Database Service (RDS) is a web service that allows for easy set up, operation, and scaling of relational databases in the cloud. Administration tasks such as hardware provisioning, database setup, patching, and backups are handled by AWS, allowing us to spend more time at the application level.

Amazon RDS supports several database instances including:

  • Amazon Aurora (port 3306)
  • PostgreSQL (5432)
  • MySQL (port 3306)
  • MariaDB (port 3306)
  • Oracle Database (port 1521)
  • SQL Server (port 1433)

Brute force attacks on exposed infrastructure are very common, and exposed Amazon RDS instances are no exception. Many times databases can contain highly sensitive data, so they are an attractive target. Although database default account lockout policies should prevent many noisy password brute force attacks, it may not be as effective against a more careful attacker that uses multiple IP addresses and attempts a smaller number of common usernames and passwords over a longer duration. Aside from brute force attacks, exposed infrastructure are also open to denial of service (DoS) attacks. Ultimately it's best no to rely on a single layer of defense (application layer security) to protect sensitive data.

It's worth noting that although in this scenario an RDS endpoint was provided, that resolves to a dynamic RDS IP address from the EC2 address pool. We could just as well connect to the IP address in this lab.

KEY TAKEAWAY

A managed database is not private by default. Setting a database to be publicly accessible places it on the internet, where it is discovered by continuous scanning within hours, and the only remaining control is the strength of its credentials.

What this lab covers

You discover a database service reachable from the internet, establish credentials for it, and read what it holds, using ordinary network tooling rather than anything cloud-specific.

The point is how mundane the path is. There is no exploit, no misconfigured policy and no privilege escalation, just a service that should not have been reachable and a password that was not strong enough.

It assumes no prior AWS or database experience and is a useful reminder that classic network security problems did not disappear when infrastructure moved.

How exposed databases are found

RDS instances have a publicly accessible setting that determines whether they receive a public endpoint. Combined with a security group permitting inbound traffic, that places the database service on the internet at a resolvable hostname.

Discovery is not targeted. The entire internet is scanned continuously by researchers, services and attackers, and databases on standard ports are identified within hours of appearing. Nobody needs to be looking for you specifically.

Once reachable, the attack is a credential attack. Databases frequently carry default or weak passwords, particularly where the instance was created for testing and then quietly kept, and many have no lockout, no multi-factor authentication and limited logging of failed attempts.

How to detect this in your own environment

Alert on the configuration change that creates the exposure. Modifying an instance to be publicly accessible is a control plane event, it is rare, and it is far more actionable than discovering the exposure later.

Enable database audit logging and watch for failed authentication volume, which is the signature of brute forcing and is frequently not collected at all on managed databases.

Scan your own external perimeter regularly. Knowing what of yours is reachable from the internet is a basic control that many organizations cannot actually perform on demand.

How to prevent it

Do not give databases public endpoints. Access should come from within the network, over a private connection or through a bastion, and the publicly accessible setting should be disabled by policy rather than by convention.

Use IAM database authentication where supported, which removes the static password entirely and ties access to cloud identity with short-lived credentials.

Restrict security groups to specific sources rather than broad ranges, and use organization policies or preventive guardrails so a publicly accessible database cannot be created accidentally in the first place.

Real-world context

Exposed databases have been behind a long series of disclosed breaches, and internet-wide scanning services routinely publish counts of publicly reachable database instances across every provider, consistently in the tens of thousands.

The common thread is lifecycle rather than ignorance. Instances created for a migration, a test or a demonstration are made reachable for convenience and then persist, with the exposure surviving long after the reason for it.

The pattern maps to MITRE ATT&CK T1595 Active Scanning, T1110 Brute Force and T1078 Valid Accounts.

Applying this at work

  • List every database instance in your accounts with public accessibility enabled, in every region.
  • Add a preventive guardrail so publicly accessible databases cannot be created without an explicit exception.
  • Enable database audit logging and alert on failed authentication volume.
  • Move to IAM database authentication where supported, removing static passwords.
  • Run an external scan of your own perimeter and compare the result against what you expected to find.

Frequently asked questions

Are RDS databases private by default?

The publicly accessible setting controls whether an instance receives a public endpoint. When enabled, combined with a permissive security group, the database is reachable from the internet at a resolvable hostname.

How quickly is an exposed database found?

Typically within hours. The internet is scanned continuously by multiple parties, and services on standard database ports are identified automatically. Discovery does not require anyone to be targeting your organization.

What is the strongest control here?

Not giving databases public endpoints at all, enforced by a preventive guardrail rather than convention. Where cloud identity authentication is supported, it also removes the static password that brute forcing targets.

Do I need my own AWS account to practice this?

No. The lab runs in a live AWS environment that Pwned Labs provisions for you, so there is nothing to set up and no risk to your own infrastructure.

Which certification covers this in depth?

The Amazon Cloud Red Team Professional (ACRTP) covers AWS attack and detection paths in full, including IAM abuse and privilege escalation, and is assessed hands-on in a live AWS account.

platform mock(1)

Cloud Security Training To Protect Your Business

Pwned Labs for Business gives your team access to dedicated business content, including labs and cyber ranges.

We also offer in-person or remote workshops, and our cloud penetration services are helping businesses become more secure!