Responding to a database exposed to the internet
A database server bound to 0.0.0.0 listens on all network interfaces, which "might be much broader access than intended by the developer or administrator".1 When that port is reachable from the internet, any address can connect, and only the password, if one is set, keeps others out. A port left open without need counts as a security misconfiguration.2 In July 2020, Shodan showed that an attack named Meow had deleted 987 Elasticsearch and 70 MongoDB databases that could be changed without credentials, leaving the word "meow" and no ransom note.3
How a database becomes public
By default, the Postgres setting listen_addresses allows only local loopback connections,4 and MongoDB binds to localhost.5 Since version 3.2.0, Redis without a password enters protected mode when its default configuration binds all interfaces.6 A database opens when listen_addresses is set to * or 0.0.0.0,4 or MongoDB's net.bindIpAll is on.5
Docker publishes a container port on all host addresses (0.0.0.0 and [::]) when no host address is given.7 The packets are routed before the rules of the ufw firewall apply, so a server whose firewall looks closed can still answer on that port.8
A Render Postgres instance accepts connections with valid credentials from any IP address.9 A Supabase project with an empty allow list lets all IP addresses connect to Postgres and its pooler.10 On Railway, a TCP proxy gives a service a public domain and port, and all traffic sent there is passed to the service.11
Close access at the provider
An allow list of CIDR ranges on the host stops connections before they reach the database.10 On DigitalOcean, usually only the application servers are allowed.12
| Provider | Steps |
|---|---|
| Supabase | Database Settings, Network Restrictions, with Owner or Admin permissions. If direct connections resolve to an IPv6 address, add both IPv4 and IPv6 ranges.10 |
| Render | The database's Info page, Networking section. The default entry is 0.0.0.0/0. Render services in the same region keep connecting through the internal URL.9 |
| DigitalOcean | Databases, the cluster, Network Access, Add Trusted Sources.12 |
| Railway | The TCP proxy that gives the database a public address is set in the service's Settings, Networking, TCP Proxy.11 |
Render's command line tool removes external access completely:9
render pg update my-database --clear-ip-allow-listSupabase's restrictions cover Postgres and the pooler only. The HTTPS APIs, such as PostgREST, Storage and Auth, stay reachable,10 and Row level security protects the data there.
Close access on a server
The command ss -tlnp lists listening TCP sockets with numeric ports and the process that holds each one.13 A local address of 0.0.0.0, * or [::] means all interfaces.4
For Docker, a port published with 127.0.0.1 in front, as in -p 127.0.0.1:5432:5432, is reachable only from the Docker host. Before release 28.0.0, hosts on the same network switch could still reach it. The default bind address for the whole daemon is set in daemon.json:7
{
"default-network-opts": {
"bridge": {
"com.docker.network.bridge.host_binding_ipv4": "127.0.0.1"
}
}
}In Postgres, set listen_addresses = 'localhost' and restart the server, since the setting is read only at start.4 The pg_hba.conf file decides who may log in once connected: the first line that matches the connection type, client address, database and user is used. In the docs' example, the first line lets 192.168.12.10 log in to the postgres database with a SCRAM-SHA-256 password check, and the second rejects 192.168.54.1.14
host postgres all 192.168.12.10/32 scram-sha-256
host all all 192.168.54.1/32 rejectSELECT pg_reload_conf(); makes the server read the edited file.14 MongoDB stays private with net.bindIp on localhost or a private address and access control turned on.515 Redis needs bind 127.0.0.1 with protected mode left on; an outside attacker with access can delete the whole data set with one FLUSHALL command.6
Change the password
While the database was open, any server could try passwords against it,12 so change it after closing access. In psql, \password app_user changes the password without exposing it as cleartext; ALTER ROLE app_user WITH PASSWORD '...' can leave the password in the command history or the server log.16 On Supabase, reset it under Database, Settings. A 28P01 error from the shared pooler right after the reset is expected, and a retry with the new password usually succeeds.17 Replacing the value in a deployed app is covered in Responding to a leaked API key.
Find out what happened
This query lists the sessions open now, with the user name, client address and start time, and the second line ends one of them:1819
SELECT pid, usename, client_addr, backend_start FROM pg_stat_activity;
SELECT pg_terminate_backend(<pid>);Postgres does not log connections by default, because log_connections starts empty. Failed logins are always logged, so the log can show password guessing during the exposure but no successful connections. Set log_connections = 'all' and log_disconnections = on for the future.20
In Supabase's Logs, the Postgres log type shows connection events when connection logging is on, and the pooler has a log type of its own. Logs are kept for 1 day on Free, 7 on Pro, 28 on Team and 90 on Enterprise. An empty result does not prove that a user had no activity.21 MongoDB's logs record authentication attempts with source IP addresses.15
Report the breach
Under Article 33 of the GDPR, a controller notifies the supervisory authority of a personal data breach without undue delay and, where feasible, within 72 hours of becoming aware of it, unless the breach is unlikely to result in a risk to the rights and freedoms of people. A processor tells the controller. All breaches are documented, with the facts, the effects and the remedial action taken.22
Notable incidents
Microsoft customer support database (2019)
On 5 December 2019, a change to the network security group of an internal Microsoft database used for support case analytics contained misconfigured rules that exposed the data.23 The search engine BinaryEdge indexed it on 28 December, and Bob Diachenko of Comparitech found it on 29 December. No password was needed, and the records covered 2005 to December 2019.24 Diachenko told BleepingComputer that the roughly 250 million records, including chats and case descriptions, sat on five identical Elasticsearch clusters, and that Microsoft secured them on 30 December.25 Microsoft gives 31 December.23
Microsoft's notice of 22 January 2020 said the investigation found no malicious use. Automated redaction had missed some personal data, such as an email address written with spaces, and Microsoft began notifying those customers. It wrote that it had solutions to prevent this kind of mistake, but they were not enabled for this database.23
In SecFlash
On the Cloud page, SecFlash reports a database that accepts connections from any address on Supabase (SF-CLD-527), Render (SF-CLD-021, and SF-CLD-804 in render.yaml) and DigitalOcean, where no trusted sources are set (SF-CLD-207), a Railway database reachable through a TCP proxy (SF-CLD-041) and a Compose file that publishes a database port on all addresses (SF-CLD-908). SF-CLD-102 and SF-CLD-203 report a Hetzner or DigitalOcean firewall rule that opens a risky port to the whole internet. The Server page shows a risky service open to the internet (SF-SRV-101) and a port that listens on all addresses and answers from outside (SF-SRV-102), and the Security page shows risky ports open (SF-SEC-302).
See also
- Publicly exposed database
- Ransomware and data destruction
- Database dumping
- Brute-force attack
- Row level security
- Securing a Docker application on a self-managed server
- Responding to a leaked API key
- Category: Incident response
References
- back MITRE. "CWE-1327: Binding to an Unrestricted IP Address". Common Weakness Enumeration.
- back "A02:2025 Security Misconfiguration". OWASP Top 10:2025. OWASP Foundation.
- back Goodin, Dan (22 July 2020). "Ongoing Meow attack has nuked >1,000 databases without telling anyone why". Ars Technica.
- a b c d "Connections and Authentication". PostgreSQL Documentation. PostgreSQL Global Development Group.
- a b c "IP Binding in Self-Managed Deployments". MongoDB Database Manual. MongoDB.
- a b "Redis security". Redis Docs. Redis.
- a b "Port publishing and mapping". Docker Docs. Docker.
- back "Packet filtering and firewalls". Docker Docs. Docker.
- a b c "Create and Connect to Render Postgres". Render Docs. Render.
- a b c d Supabase (updated 16 November 2026). "Network Restrictions". Supabase Docs.
- a b "TCP Proxy". Railway Docs. Railway.
- a b c "How to Secure PostgreSQL Managed Database Clusters". DigitalOcean Docs. DigitalOcean.
- back "ss(8)". Linux manual page. man7.org.
- a b "The pg_hba.conf File". PostgreSQL Documentation. PostgreSQL Global Development Group.
- a b "Security Checklist for Self-Managed Deployments". MongoDB Database Manual. MongoDB.
- back "ALTER ROLE". PostgreSQL Documentation. PostgreSQL Global Development Group.
- back Supabase (updated 4 November 2026). "How do I reset my Supabase database password?". Supabase Docs.
- back "The Cumulative Statistics System". PostgreSQL Documentation. PostgreSQL Global Development Group.
- back "System Administration Functions". PostgreSQL Documentation. PostgreSQL Global Development Group.
- back "Error Reporting and Logging". PostgreSQL Documentation. PostgreSQL Global Development Group.
- back Supabase (updated 18 November 2026). "Logs". Supabase Docs.
- back "Art. 33 GDPR: Notification of a personal data breach to the supervisory authority". gdpr-info.eu (text of Regulation (EU) 2016/679).
- a b c MSRC Team (22 January 2020). "Access Misconfiguration for Customer Support Database". Microsoft Security Response Center. Read from the Internet Archive copy.
- back Comparitech. "250 million Microsoft customer service & support records exposed". Comparitech (original report January 2020).
- back Gatlan, Sergiu (22 January 2020). "Microsoft Exposes 250M Customer Support Records on Leaky Servers". BleepingComputer.
External links
- CWE-1327: Binding to an Unrestricted IP Address, MITRE
- Port publishing and mapping, Docker Docs