MongoDB
1) Run nmap
nmap -sV --script mongodb-brute -n -p 27017 <IP>nmap -sV --script "mongo* and default" -p 27017 <IP>2) Metasploit MongoDB Login Scanner
use auxiliary/scanner/mongodb/mongodb_login
set RHOSTS <target_ip>
set RPORT 27017
run3) Manual Interaction via PyMongo
from pymongo import MongoClient
client = MongoClient('host', 27017, username='username',
password='password')
client.server_info() # Retrieve basic server info
admin = client.admin #If we have admin creds available
admin_info = admin.command("serverStatus")
# List databases
cursor = client.list_databases()
for db in cursor:
print(db)
print(client[db["name"]].list_collection_names())4) MongoDB commands
5) MongoDB Login methods
6) Manual Inspection
7) Default Admin Users
8) Misconfigured Role-Based Access Control (RBAC)
9) File System Access via MongoDB
10) Insecure Bindings
11) Misconfigured backup systems
12) Execute commands
Requirements: An application that uses the database runs as the owner we want to escalate
Steps:
1)
2) Copies the bash binary and gives ownership and SGID set with the context of the user that the database is running
Last updated