Listing MongoDB databases
MongoDB may contain several databases in a single installation. Listing databases is useful to both system administrators and penetration testers, and there is an NSE script that allows them to do this easily, and even in an automated manner.
This recipe describes how to use Nmap to list databases in MongoDB.
How to do it...
To list MongoDB databases by using Nmap, enter the following command:
$ nmap -p 27017 --script mongodb-databases <target>
The databases will be shown in the script output section:
PORT STATE SERVICE 27017/tcp open mongodb | mongodb-databases: | ok = 1 | databases | 1 | empty = true | sizeOnDisk = 1 | name = local | 0 | empty = true | sizeOnDisk = 1 | name = admin | 3 | empty = true | sizeOnDisk ...
Get Nmap 6: Network Exploration and Security Auditing Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.