Unauthorized access to a MongoDB database can result in data leaks, data deletion, or even extortion.
Background information
To ensure the security of your business and applications, Cloud Firewall provides a solution to fix the vulnerability of unauthorized access to a MongoDB database.
After MongoDB is installed, an admin database is created. The admin database is empty by default. You cannot view user authentication information in the database.
By default, MongoDB has no requirements for user authentification. If you do not configure parameters when you start MongoDB, user authentication is not required for access to the MongoDB database. As a result, users do not require a password to remotely access the MongoDB database. Then, the users can perform operations on the database by using the default port. These operations include high-risk operations that are performed to insert, delete, modify, or query data.
To address this issue, you must add users to the admin.system.users collection. This way, user authentication is enabled for MongoDB.
Solution
Check for intrusions
If you are a MongoDB administrator, you can take the following measures to check for intrusions:
- Check whether the MongoDB log is complete. Then, check the IP address of the user who deletes the database and the time when the database was deleted.
- Run the db.system.users.find() command to check whether a password is configured for each MongoDB account.
- Run the db.fs.files.find() command to check whether other users store files by using GridFS.
- Run the show log global command to view log files. Then, check whether other users access the MongoDB database.