Open Redis and other unauthenticated databases: a quick exposure check
Redis, like several other popular data stores, ships out of the box with no password required to connect, assuming only trusted clients will ever reach it — an assumption that breaks the moment a server gets a public IP. These database ports aren't on AdminKit's port-check tool's nine-port list, so this guide shows how to check whether yours is exposed.
By AdminKit team, Netbase JSC · Updated
Key takeaways
- Redis, Memcached and several other data stores are built to trust whoever can reach the port. Their safety depends on the network keeping strangers out, not on a password.
- Defaults differ by product and have improved over time: MongoDB binds to localhost, current Elasticsearch sets a password and TLS on first start, and Memcached turned UDP off in 1.5.6. None of that helps once someone changes the bind address or publishes the port.
- A frequent modern cause is containers: Docker’s own documentation says publishing a port makes it available “to the outside world as well” unless you bind it to 127.0.0.1.
- Check from outside your network, read the reply (PONG, NOAUTH, a protected-mode error, a 401 status), then fix in layers: bind address, authentication, firewall.
Why do Redis and similar databases ship without a password?
Redis’s own security documentation states its security model plainly: “Redis is designed to be accessed by trusted clients inside trusted environments,” adding that “usually it is not a good idea to expose the Redis instance directly to the internet or, in general, to an environment where untrusted clients can directly access the Redis TCP port.” The intended architecture is that an application server sits between untrusted end users and Redis, handling access control and input validation itself — Redis is the fast internal data layer, not the public-facing boundary. That design choice runs all the way down to the wire protocol: RESP itself carries no authentication fields, so any client that can open a connection can issue any command the server accepts, with nothing to stop it at the protocol level.
That design is reasonable in its intended context. The problem is what happens when the “trusted environment” assumption silently fails: a server gets deployed to a cloud provider with a public IP and a broader-than-expected default firewall rule, a developer binds Redis to all interfaces instead of localhost during testing and the change never gets reverted, or a container’s port gets published externally by a deployment script nobody audited closely. In each case, Redis itself hasn’t changed — the trust boundary around it has quietly disappeared.
What’s actually at stake
Redis’s documentation doesn’t understate the consequences: “failing to protect the Redis port from the outside can have a big security impact because of the nature of Redis. For instance, a single FLUSHALL command can be used by an external attacker to delete the whole data set.” Beyond data destruction, an attacker with unrestricted command access can read every key in the database — which, depending on what your application stores there, might include session tokens, cached user data, or application state never meant to leave your own infrastructure. OWASP’s Top 10 lists exactly this pattern — a data store left on its insecure-by-default configuration — under Security Misconfiguration.
Which databases are open by default, and how open?
Redis is the best-known case, but the same question applies to every data store on a server with a public address. The defaults below come from each project’s documentation; the right-hand column is what to confirm on your own install.
| Data store | Default port | Default network binding | Authentication out of the box | What to confirm |
|---|---|---|---|---|
| Redis | 6379/TCP | Shipped redis.conf binds loopback; protected mode blocks outside clients when no password is set | None until you set requirepass or ACL users | bind line, protected-mode, ACL users |
| MongoDB | 27017/TCP | mongod and mongos “bind to localhost by default” | Access control must be enabled; it is the first item on MongoDB’s security checklist | net.bindIp, security.authorization |
| Elasticsearch | 9200/TCP (HTTP), 9300/TCP (transport) | Local only until network settings are changed | Current releases generate TLS certificates and an elastic password on first start | That security was not switched off, and which users exist |
| Memcached | 11211/TCP (UDP off since 1.5.6) | Depends on the package; check the -l option | None by default; SASL is optional | -l listen address, -U 0 for UDP |
The pattern is the same in every row. The project made a sensible default for a single machine, and the exposure comes from a later change that widened the listening address: binding to 0.0.0.0 so another server can connect, a cloud image with a different default, or a container published to every interface. MongoDB’s documentation is direct about it: “make sure that your mongod and mongos instances are only accessible on trusted networks.”
Memcached is a useful reminder that exposure is not only about data. Its 1.5.6 release notes explain that UDP was disabled by default after reports of amplification attacks, in which attackers stored large values and then sent spoofed UDP requests so that memcached “will then send a very large number of very large UDP packets” to a victim. An open cache can harm third parties even when nothing in it is sensitive.
How do containers expose a database by accident?
Docker is now one of the most common ways a database ends up reachable from the internet. The Docker port-publishing documentation carries an explicit warning: “Publishing container ports is insecure by default. Meaning, when you publish a container’s ports it becomes available not only to the Docker host, but to the outside world as well.” The fix it gives is to include a loopback address in the publish flag:
# Reachable from any network the host is on
docker run -d -p 6379:6379 redis
# Reachable only from the Docker host itself
docker run -d -p 127.0.0.1:6379:6379 redis
The same applies to ports: entries in Compose files. If an application container is the only client, it is usually better not to publish the database port at all and let the two containers talk over a private Docker network. Also check that host firewall rules really apply to published container ports on your system before relying on them, since Docker manages its own packet-filtering rules for published ports.
The safety net Redis added, and its limits
Since version 3.2.0, Redis has shipped with protected mode: when the server is running with its default configuration (bound to all interfaces) and no password configured, it automatically refuses queries from anything other than the loopback interface, replying to other connections with an explanatory error instead of serving the request. It’s a genuinely useful default-safe behavior. But it’s exactly that — a default — and it stops applying the moment an administrator sets any password (even a weak one) or explicitly re-enables broader binding, at which point the instance is back to relying entirely on whatever authentication and network controls were actually configured.
How do I check whether my database is exposed?
- Identify your public-facing IP with AdminKit’s what is my IP tool.
- Test whether your database port responds from outside — port 6379 for Redis, or the relevant default port for another unauthenticated-by-default store. AdminKit’s port check tool’s fixed nine-port list doesn’t cover database ports, so run a manual, TCP-aware check such as
nc -vz your-public-ip 6379instead, only against infrastructure you own or are authorized to test. - If it responds, check whether a password is actually required before assuming the worst — a reachable port with strong authentication behind it is a very different risk than a reachable port with none.
- Fix in layers, not just one. Set a strong password (or configure Access Control Lists for more granular permissions), bind to a private interface rather than all interfaces, and add a firewall rule scoped to only the clients that need access — redundancy here is the point, since any single control failing shouldn’t leave the database fully open.
Reading the reply
Once a TCP connection succeeds, a single harmless read-only request tells you whether authentication is in place. Run these only against your own address (here a documentation address) from a host outside your network:
$ redis-cli -h 203.0.113.5 -p 6379 PING
PONG # open, no authentication
(error) NOAUTH Authentication required. # reachable, password set
(error) DENIED Redis is running in protected mode ... # reachable, protected mode refusing
$ curl -s -o /dev/null -w "%{http_code}\n" http://203.0.113.5:9200/
200 # Elasticsearch answering without credentials
401 # security enabled, credentials required
| Result | Meaning | Priority |
|---|---|---|
| Connection refused or timed out | Not reachable from outside | Record it and move on |
PONG, HTTP 200 with cluster details, or a MongoDB shell that lists databases | Reachable and unauthenticated | Fix today: anyone can read or wipe the data |
NOAUTH, a 401 status, or an authentication error | Reachable, credentials required | Still close the port; a password should not be the only control |
| Protected-mode error | Reachable, Redis refusing because no password is set | Close the port before someone “fixes” the error by turning protected mode off |
The last row deserves attention. The protected-mode error message tells the reader how to disable protected mode, and the quickest way to make an application work again is to follow it. Treat that error as a signal to change the bind address, not to remove the safeguard.
Configuration that closes it
A minimal, layered setup for the two most common cases:
# redis.conf
bind 127.0.0.1 -::1
protected-mode yes
# then create ACL users and disable the default user (see Redis ACL docs)
# mongod.conf
net:
bindIp: 127.0.0.1,10.0.0.12 # loopback plus one private interface
security:
authorization: enabled
For Memcached, start it with an explicit private listen address and UDP disabled, for example memcached -l 127.0.0.1 -U 0. For Elasticsearch, keep the security features that current releases switch on at first start, and do not disable them to get a client working. In every case, add a firewall rule that allows the database port only from the application hosts that need it.
Why a shared or dynamic public IP doesn’t make this safer
If your server’s outward-facing IP is shared via Carrier-Grade NAT or changes periodically, that’s not a form of security for an exposed database — see our CGNAT guide for why a shared address can actually complicate incident response (telling your traffic apart from a neighbor’s) rather than hiding you from automated scanners, which check every reachable address regardless of who else might be behind it. This exposure check is part of AdminKit’s machine protocols cluster of device and service exposure guides.
This guide is general information, not a security audit of your specific network — see our disclaimer for what AdminKit's guidance does and does not commit to.
Frequently asked questions
Why does Redis ship without a password by default?
Redis's own security documentation is explicit about this: it's "designed to be accessed by trusted clients inside trusted environments," with the expectation that an application layer, not Redis itself, mediates access from untrusted users. That's a reasonable default for a database meant to sit behind an application server, but it means the database itself has no credential requirement unless you add one.
What can someone do with an exposed, unauthenticated Redis instance?
Anything the Redis command set allows, with no restriction — read every key, write arbitrary data, or run commands like FLUSHALL to delete the entire dataset. Redis's own documentation warns specifically that failing to protect the port 'can have a big security impact because of the nature of Redis,' citing data-wiping as a concrete example.
Didn't Redis fix this with 'protected mode'?
Partially. Since version 3.2.0, Redis enters protected mode automatically when running with default configuration and no password set, refusing connections from anything but the loopback interface. It's a meaningful safety net, but an administrator can disable it, misconfigure the bind address, or add a password without realizing protected mode then stops applying the same restriction — it reduces the risk, it doesn't eliminate the underlying design.
Is this a Redis-specific problem, or does it apply to other databases too?
The pattern is common across data stores designed for speed and simplicity more than defense-in-depth — several NoSQL and in-memory databases have shipped with no-auth-by-default configurations over the years, and the same self-check logic (confirm whether it's reachable from outside, confirm whether it requires a credential) applies to any of them.
What's the fastest fix if I find my own instance exposed?
Set a strong password with Redis's AUTH mechanism or its newer Access Control Lists, bind the instance to a private or loopback interface instead of all interfaces, and add a firewall rule restricting the port to only the application servers that actually need it — all three together, not just one.
How do I check if my database port is reachable from the internet?
AdminKit's [port check](/tools/port-check/) tool's fixed list of nine checked ports doesn't include Redis (6379) or any other database port — see the port-check tool page for the current list. Test a database port manually instead, from outside your network, with a TCP-aware check such as `nc -vz your-public-ip 6379`, which answers the most urgent question before anything else: is this reachable by anyone who finds it.
Sources
- Redis security — official documentation
- OWASP Top 10 (2021) — A05 Security Misconfiguration
- MongoDB — IP binding in self-managed deployments
- MongoDB — Security checklist for self-managed deployments
- Elastic — Automatic security setup (self-managed Elasticsearch)
- memcached 1.5.6 release notes (UDP disabled by default)
- Docker — Port publishing and mapping
Related tools
Want AdminKit to watch this for you?
Free checks tell you the state today. Protective DNS and monitoring tell you when it changes.
Talk to an expert
Huy Nguyen (David), Founder & CEO, Netbase JSC
Ask whether this fix applies to your setup, or get a second pair of eyes on your DNS and mail records.