Skip to content
Back to Blog
·10 min read·technology

Exposed Databases: Redis and MongoDB Open to the Internet

Exposed databases: Redis, MongoDB and Elasticsearch left open on the internet get found in minutes. Learn how to bind, authenticate, and firewall them shut.

BR

Bachao.AI Research Team

Cybersecurity Research

Scan Your Attack Surface

Security exposure this creates

Unpatched vulnerabilities in your tech stack are the #1 entry point for breaches targeting Indian businesses. Here's what to watch.

An exposed database is a Redis, MongoDB, Elasticsearch, or PostgreSQL instance reachable from the public internet with weak or no authentication — usually because it was bound to 0.0.0.0 instead of a private interface during a quick deployment. Internet-wide scanning tools index every open database port continuously, so an unauthenticated instance is often found within hours of going live, sometimes minutes. Attackers then either exfiltrate the data quietly or delete it and drop a ransom note demanding payment for its return. The fix is almost never a code change — it is binding to localhost or a private subnet, enabling authentication, and closing the port at the firewall.

How Databases End Up Facing the Open Internet

Nobody sets out to expose a production database. It happens through small, individually reasonable decisions that stack up badly: a developer spins up MongoDB in Docker for local testing and the container's default network mode maps the port straight through to the host; a DevOps engineer opens a Redis security group to 0.0.0.0/0 during a demo, intending to lock it down "after"; an Elasticsearch cluster for log aggregation never gets an authentication layer because the open-source distribution historically shipped without one; a PostgreSQL instance migrated from on-prem inherits a pg_hba.conf rule that was fine on a private LAN and is catastrophic on a public IP.

DatastoreDefault portAuth enabled by defaultCommon exposure cause
Redis6379No — requirepass must be set manuallyCache spun up for a quick project, bound to all interfaces
MongoDB27017No in older/default configs — must enable authorizationDocker -p 27017:27017 mapping, dev instance left running
Elasticsearch9200No in the open-source distribution unless security features are enabledLog aggregation cluster exposed for a Kibana dashboard
PostgreSQL5432Yes (password required), but pg_hba.conf can be set to trustLift-and-shift from an on-prem network with a permissive host-based auth rule
⚠️
WARNING
Cloud default security group rules and container network modes both tend toward "reachable" rather than "isolated." A container started with a port-publish flag and no additional network restriction is exposed the moment the host has a public IP — there is no separate step where you "decide" to expose it. Authentication and network exposure are separate settings, and a team can get the first right while getting the second catastrophically wrong: a strong password does not matter if the port itself is reachable from anywhere on the internet, and Redis has no password at all unless one is explicitly configured.

Found in Minutes: How Attackers Discover Exposed Databases

Discovery of exposed databases does not require a targeted attack on your company. Internet-wide scanning platforms continuously probe the entire IPv4 address space across common service ports, building searchable indexes of what is listening where. Security researchers running honeypot databases with no authentication have repeatedly observed the first unsolicited connection arriving within hours of going live — in many documented cases, within minutes — independent of whether anyone is specifically looking for that organization.

Once a scanner finds an open port running Redis, MongoDB, Elasticsearch, or PostgreSQL, automated tooling attempts a connection. If no authentication is required, or a default/weak credential works, the script can enumerate databases, collections, or tables within seconds — the database itself reveals what data is present through its own schema and sample records.

🚨
DANGER
An exposed database with no authentication does not require the attacker to guess a password, exploit a vulnerability, or bypass any control — it is designed to answer any client that connects to its port. "No auth" and "publicly reachable" together mean the data is already effectively public.
graph TD A[Database Deployed] --> B{Bound to 0.0.0.0 or Localhost} B -- Bound to 0.0.0.0 --> C[Port Reachable on Public IP] C --> D[Internet Wide Scan Finds Port] D --> E[Attacker Connects With No Auth] E --> F[Data Exfiltrated or Deleted] F --> G[Ransom Note Dropped in Place of Data] B -- Localhost Plus Auth Plus Firewall --> H[Port Not Reachable Externally] H --> I[Internet Scan Finds Nothing to Connect To] I --> J[Data Stays Under Owner Control] style A fill:#1e3a5f,stroke:#3B82F6,color:#e2e8f0 style B fill:#1e3a5f,stroke:#3B82F6,color:#e2e8f0 style C fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style D fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style E fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style F fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style G fill:#5f1e1e,stroke:#EF4444,color:#e2e8f0 style H fill:#1e3d2f,stroke:#10B981,color:#e2e8f0 style I fill:#1e3d2f,stroke:#10B981,color:#e2e8f0 style J fill:#1e3d2f,stroke:#10B981,color:#e2e8f0

The Ransom Note Playbook

The pattern that gives this attack class its name is well documented across security research: an automated script connects to an unauthenticated database and, instead of quietly copying the data, replaces it. A new collection, table, or key is created — often named readme, warning, or recovery — stating that the original data has been copied or deleted and demanding payment, typically in cryptocurrency, for its return.

The uncomfortable detail security researchers have repeatedly documented is that payment does not reliably restore anything. In several widely reported waves of database-wiping activity, attackers destroyed the original data outright and left only the ransom message — there was never a backup on the attacker's side, because the tooling is built to delete and overwrite as fast as possible across as many targets as possible, not to preserve a copy for later extortion. The note is frequently the only thing left; the leverage it implies may not exist.

This makes the ransom note pattern a business continuity failure, not just a security incident. An organization that finds its database replaced has to answer two questions at once: is there a clean backup, and was data read or copied before it was overwritten — because if personal data was present, that triggers separate regulatory obligations regardless of whether the ransom is paid.

🛡️
SECURITY
Under CERT-In's 2022 Cyber Security Directions, unauthorised access to systems or data is a reportable incident category, with reporting required within six hours of noticing it — far shorter than most incident response plans assume. An exposed database wiped or exfiltrated by an automated script falls within scope. See CERT-In's directions for the reportable-incident list.

Know your vulnerabilities before attackers do

Run a free VAPT scan — takes 5 minutes, no signup required.

Book Your Free Scan

Which Datastores Get Hit Most

Exposure research and honeypot studies consistently find certain datastores over-represented among internet-facing, unauthenticated instances — largely a function of how each project's defaults shaped early deployment habits rather than any inherent weakness in the software. The distribution below is a qualitative pattern rather than a single cited measurement, since exact counts shift constantly as instances are found, fixed, and re-exposed.

pie title Commonly Exposed Datastore Types Seen in Exposure Research "MongoDB" : 32 "Elasticsearch" : 24 "Redis" : 20 "PostgreSQL" : 14 "Other datastores" : 10

MongoDB and Elasticsearch appear disproportionately partly because both were, for years, straightforward to run without any authentication configuration — a working cluster in minutes, without ever being prompted for a password. Redis follows the same logic: designed as a fast, trusted-network cache rather than an internet-facing service, which is why it turns up unauthenticated so often. PostgreSQL requires a password by default, part of why it appears less here, but a pg_hba.conf set to trust for a wide address range removes that protection entirely.

The Business Impact for Indian Companies

For an Indian company, an exposed database carrying personal data is not only an operational incident — it is a direct regulatory exposure event under the Digital Personal Data Protection Act, 2023. The Act places accountability on the data fiduciary for reasonable security safeguards, and a database reachable with no authentication is difficult to characterize as reasonable under that standard.

₹250 croreMaximum penalty ceiling for significant DPDP Act violations, including failure to prevent a personal data breach (MeitY, DPDP Act 2023)
6 hoursWindow to report a cyber security incident to CERT-In after it is noticed (CERT-In Cyber Security Directions, 2022)

Beyond the regulatory angle, an exposed and wiped production database is a continuity event: services relying on it go down the moment the data disappears, and recovery time depends entirely on whether a clean, tested backup exists outside the compromised environment. Discovering the exposure only when the service breaks means discovering it after the data was already accessed by whoever found the open port first.

Locking It Down: The Fix

None of the controls that prevent this attack class require rewriting application code — they are configuration and network changes, typically verifiable within a single working session.

ControlRedisMongoDBElasticsearchPostgreSQL
Bind to private interfaceSet bind to a private IP, not 0.0.0.0Set bindIp to private/localhost onlySet network.host to a private interfaceSet listen_addresses to specific private IPs
Enable authenticationSet requirepass or configure Redis ACLsEnable authorization: enabled and create scoped usersEnable the security features and set user credentialsEnsure pg_hba.conf requires password auth, never trust, for any non-loopback range
Firewall the portRestrict 6379 to application servers onlyRestrict 27017 to application servers onlyRestrict 9200 to internal network onlyRestrict 5432 to application servers only
Use a private networkPlace in a VPC subnet with no public routePlace in a VPC subnet with no public routePlace in a VPC subnet with no public routePlace in a VPC subnet with no public route
Rotate credentials post-incidentYes, if exposedYes, if exposedYes, if exposedYes, if exposed
💡
TIP
Test the fix from outside your own network, not from inside it. A firewall or security group change that looks correct in the console can still leave a port reachable if a broader rule elsewhere in the chain — a load balancer, a NAT gateway, a peered VPC — quietly overrides it.

OWASP's Top 10 lists security misconfiguration as its own risk category precisely because it recurs across every stack for the same reason: a secure default gets overridden for convenience, and nobody revisits it. See OWASP's guidance for a broader checklist beyond databases, and the NIST Cybersecurity Framework for the segmentation principles that make "private subnet by default" the right starting posture.

🎯Key Takeaway
An exposed database is rarely discovered by your own team first — internet-wide scanning finds unauthenticated Redis, MongoDB, Elasticsearch, and PostgreSQL instances continuously, often within hours of them going live. The controls that prevent this are configuration, not code: bind to a private interface, require authentication, and put a firewall rule in front of the port. Verifying these are actually true — not just configured once and assumed to still hold — is the difference between a database nobody can reach and a ransom note replacing production data.

Why Continuous Checking Catches This Before Attackers Do

A one-time review of database bindings and firewall rules tells you the state of things on the day of the review. New databases get spun up for new features, staging environments get promoted without their network settings revisited, and cloud provider defaults change over time in ways that can silently reopen a closed port. The gap between "we checked this six months ago" and "this is still true today" is where exposed-database incidents live.

Bachao.AI runs automated vulnerability assessment and penetration testing for Indian companies, including checks for internet-reachable databases and the authentication and network configuration around them, so an exposed Redis or MongoDB instance is found by a scheduled scan rather than by whoever runs the next internet-wide sweep. Where a compliance need requires CERT-In empanelled reporting, that is delivered with a CERT-In empanelled partner. Dhisattva AI Pvt Ltd built the platform around continuous checking because point-in-time audits leave this exact gap open between reviews.

If you are not certain whether any database in your environment is reachable from outside your own network, that is worth confirming directly rather than assuming your cloud provider's defaults have you covered. A free VAPT scan checks for exposed database ports and weak or missing authentication, and for DPDP-specific obligations around personal data safeguards, see the DPDP compliance overview. For more, browse our blog.

Frequently Asked Questions

How quickly do attackers find an exposed database?
Honeypot experiments with deliberately unauthenticated databases have repeatedly shown the first connection arriving within hours of going live, sometimes minutes, regardless of whether the organization was specifically targeted.
Is Redis unauthenticated by default?
Yes. Redis needs no password unless requirepass or Redis ACLs are explicitly configured, since it was designed for a trusted internal network rather than direct internet exposure.
What is a database ransom note attack?
An automated script connects to an unauthenticated database, copies or deletes the data, and replaces it with a new collection, table, or key containing a payment demand. In several documented waves of this activity, the original data was destroyed outright with no backup retained, meaning payment did not reliably restore anything.
Does the DPDP Act apply if an exposed database only leaks non-personal data?
DPDP obligations center on personal data. If the database holds personal data, the incident falls within the Act's safeguard and breach obligations; non-personal operational data alone does not trigger DPDP obligations the same way, though it may still be reportable to CERT-In.
What is the fastest fix for an exposed database found today?
Bind it to a private interface or localhost, enable authentication if not already required, and correct the firewall rule restricting the port to the servers that need it — changes verifiable within a single working session, followed by credential rotation if exposure occurred.
Can a firewall alone protect a database with weak authentication?
A firewall rule restricting the port to trusted sources is strong, but not sufficient alone. Rules can be misconfigured or bypassed through a peered network, so authentication should always be enabled too.
BR

Bachao.AI Research Team

Cybersecurity Research

AI-powered security research and threat intelligence from the Bachao.AI team. Covering the latest vulnerabilities, CVEs, and cybersecurity developments affecting Indian businesses.

Get cybersecurity insights for Indian SMBs

Weekly vulnerability alerts, DPDP compliance tips, and security guides. No spam — unsubscribe anytime.

We respect your privacy. Your email is never shared.

Find out if you're exposed to this class of threat

Free automated scan — risk score in under 2 hours. No credit card required.

Scan Your Attack Surface
Find your vulnerabilitiesStart free scan →