MongoDB Without Authentication
A MongoDB server accepts connections without requiring authentication, so anyone who can reach it can read, change or delete every database it holds.
| Severity | Critical |
| CVSS 3.1 | 9.8 CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H Open in the calculator |
| CVSS 4.0 | 9.3 CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N Open in the calculator |
| CWE | CWE-306: Missing Authentication for Critical Function |
| OWASP Top 10 | A07:2025 Authentication Failures |
| MITRE ATT&CK | T1213.006 Databases, T1485 Data Destruction, T1565.001 Stored Data Manipulation |
| Category | Broken Access Control |
Description
The MongoDB server does not have access control enabled, so it accepts commands from any client that connects without asking for credentials. MongoDB enforces authentication only when access control is switched on in its configuration, and instances created for development, carried over from old versions or started from container images without the authentication settings are often left in this state. Current releases listen only on the loopback interface by default, but this is commonly changed so that application servers can connect, which exposes the unauthenticated service to every other host that can reach the port.
Anyone who can reach the port can read every database on the server, including personal data, credentials and application secrets stored there, and can insert, change or delete records, which could alter application behaviour or create privileged application accounts. They can also drop whole databases and add administrative MongoDB users to keep access, so the impact is limited only by what the instance stores and by which networks can reach it. Automated campaigns search the internet for unauthenticated MongoDB servers, copy or delete their contents and leave ransom demands, so internet-facing instances are at particular risk.
The issue is confirmed by connecting to the service, normally on TCP 27017, with a client such as mongosh or the Nmap mongodb-databases script, and listing databases and collections without supplying credentials. Scanners report it as MongoDB unauthenticated access or as a database list returned to an anonymous client.
Remediation
Enable authentication and limit who can connect:
- Create an administrative user, then enable access control by setting
security.authorization: enabledin themongodconfiguration file (or startingmongodwith--auth) and restart the service. For replica sets and sharded clusters, also configure internal authentication between members with a keyfile or X.509 certificates. - Give each application its own user with a role limited to the databases and actions it needs, rather than a cluster-wide administrative role.
- Set
net.bindIpto the loopback address and the specific internal interface the application servers use, and restrict TCP 27017 with firewall rules to those servers and administration hosts. - Enable TLS for client and member connections.
Because the data may already have been read or changed, review the server's logs and data for signs of unauthorised access, and rotate any credentials or secrets stored in it. Confirm the fix by connecting without credentials and checking that listing databases is refused.
References
Add This Finding to Your Library
In Pental this write-up is in Settings, Library. Add to my library copies it into your own, rated in your firm's CVSS version, ready to put in your own words.
Free trialYour trial starts when your portal goes live, not when you sign up, so the time you spend setting up does not count. · No card required
Only need the reporting? Our reporting tool is free and open source, with the same library.