Skip to main content

Wolfcore Cyber Security

Port 27017 (MongoDB): what it is, how it is attacked and how to secure it

Written by Ruben Selby, founder and penetration tester at Wolfcore. Last reviewed 17 November 2026. Part of the Ports and protocols library.

In one sentence: Port 27017 is the door through which applications talk to a MongoDB database, and if that door faces the internet, anyone can try to talk to your data.

What runs on this port

MongoDB documents 27017 as the default port for mongod and mongos, the database server and its routing process. Your website, app or reporting tool connects here to read and write records. The port should be reachable by those systems only, not by the whole internet.

MongoDB is a document database. It stores flexible, JSON-like records instead of rows and tables. Start-ups, SaaS products and internal tools use it a great deal, often on a cloud server set up quickly.

Why attackers look for it

Attackers do not pick targets by name. They scan the internet for open database ports and then see what answers. Palo Alto Networks’ Unit 42 reported that its Cortex Xpanse tool identified approximately 146,000 MongoDB instances exposed to the internet when it wrote about the MongoBleed flaw. Exposed does not mean vulnerable, but it does mean findable.

How it gets attacked

The common weaknesses are the usual ones for databases: no authentication switched on, weak or shared passwords, no encryption in transit, old versions and a port open to the world. MongoDB’s own security checklist tells operators to enable access control, give each person and application its own user with least privilege, encrypt traffic with TLS and limit network exposure with firewalls and security groups.

A named flaw: MongoBleed (CVE-2025-14847). Unit 42 reports that MongoDB disclosed this on 19 December 2025. It is an unauthenticated memory disclosure flaw with a CVSS score of 8.7. In plain English: a stranger can send a malformed message and get back fragments of the server’s memory, which can include credentials, API keys and personal data. The flaw sits in how the server handles zlib-compressed messages, a feature that is on by default, and it is reachable before login. An attacker only needs network access to the default port.

Unit 42 also reports a public proof of concept appeared on 26 December 2025 and that CISA added the flaw to its Known Exploited Vulnerabilities catalogue on 29 December 2025. Affected versions include 8.2.0 to 8.2.2, 8.0.0 to 8.0.16, 7.0.0 to 7.0.27, 6.0.0 to 6.0.26, 5.0.0 to 5.0.31 and 4.4.0 to 4.4.29. Versions 4.2, 4.0 and 3.6 are end of life with no fix. Unit 42 notes that MongoDB’s managed Atlas service was patched automatically, but self-hosted servers need manual patching.

Unit 42 adds a useful point for defenders: the leaked data comes back as random fragments, so an attacker needs thousands of requests. That makes real exploitation noisy.

Exposed versus protected port 27017Internet scannerPort 27017 openMongoDB serverBefore: any address can reach the database, so memory fragments can leakInternet scannerFirewall allow-listblocks the requestApp server only

Who it affects and how badly

  • Sole trader to 10 staff (for example a small SaaS start-up or an agency with a customer portal): a database on a cloud server with the port open. Worst case is customer data read by strangers and a notification duty to customers.
  • 10 to 50 and 50 to 250 staff (retail, recruitment, fintech, MSPs hosting customer apps): leaked credentials from memory can unlock other systems. Worst case is downtime while you rebuild, plus a personal data breach to report.
  • Regulated businesses (fintech, insurance, healthcare suppliers) in the UK, EU, US and Armenia: a breach of personal data triggers regulator reporting and possible fines, and client contracts often demand patching evidence.

The ICO’s data security guidance says UK GDPR requires “appropriate technical and organisational measures”, and that you should test the effectiveness of those measures. A database open to the internet is hard to defend as appropriate.

Real examples

The UK angle

The ICO’s security principle expects risk-based measures and regular testing, and names vulnerability scanning and penetration testing as ways to do that (https://ico.org.uk/for-organisations/uk-gdpr-guidance-and-resources/security/a-guide-to-data-security/). If a UK business loses personal data from an exposed database, the ICO question is whether you took appropriate steps. A firewall rule and a patch are cheap answers.

What we check on a test

This is our method, not a list of findings.

  • Whether 27017 to 27019 answer from outside the network, and from which networks.
  • Whether the server demands a login, and which authentication method it uses.
  • The server version against known advisories, including CVE-2025-14847.
  • Whether traffic is encrypted with TLS.
  • Whether application database users have more rights than they need.
  • Whether secrets that could sit in memory or config (connection strings, API keys) are rotated and kept out of code.

How to check whether yours is exposed

  1. List every server that runs a database and write down its public address, if it has one.
  2. Read your firewall rules or cloud security groups for 27017, 27018 and 27019 open to “any” address.
  3. Run our free scan from outside your network: https://wolfcore.co.uk/free-web-vulnerability-scan/
  4. Check the MongoDB version on each self-hosted server against the advisory.

How to secure it

  1. Block inbound internet access to 27017 and allow only named application servers, as Unit 42’s interim guidance recommends.
  2. Patch self-hosted MongoDB to a release that fixes CVE-2025-14847, using MongoDB’s advisory, and replace end-of-life versions.
  3. If you cannot patch at once, disable zlib compression as a temporary step, as Unit 42 suggests.
  4. Turn on access control and role-based users, one per person or application, with least privilege.
  5. Encrypt connections with TLS and set net.bindIp so the server listens only where it must.
  6. Rotate credentials and API keys that a vulnerable server could have held in memory.

FAQ

Is port 27017 dangerous? It is the normal MongoDB port. It is dangerous when open to the internet, because the MongoBleed flaw can be triggered before login.

Was MongoBleed exploited? Unit 42 reports that CISA added it to its exploited vulnerabilities list on 29 December 2025.

Do Atlas customers need to patch? Unit 42 says MongoDB patched Atlas automatically. Self-hosted servers need manual patching.

Related terms

port-6379-redis, port-3306-mysql, port-9200-elasticsearch, cisa-kev, patch-management, how-to-check-which-ports-are-open-on-your-network

How Wolfcore helps

A Wolfcore penetration test finds this the way an attacker would, by hand, not with a scanner. Start with the free web vulnerability scan or read about penetration testing.

Wolfcore

Would your staff click a phishing email?

Run a real, safe phishing test on your team with Phishy. Free for 14 days, up to 10 staff, no card. We help you set it up.

Start a free phishing testFree website security scanor book a 30 minute call