
This script is used to identify MongoDB services that are network-exposed and allow unauthenticated protocol handshakes.
mongo_exposure_scanner.py
Verify Python:
python3 --version
| File | Purpose |
|---|---|
mongo_scanner.py | Scanner script |
targets.txt | Target hosts and ports |
mongo_exposed_targets.txt | Scan results (auto-created) |
targets.txt)Supported formats:
# Host only (default ports used)
10.99.1.52
# Host with specific port
mongo.example.com:3717
# Multiple ports
192.168.1.10:27017,28017
# Port range
172.16.0.20:27017-27030
Notes:
# lines are ignoredRun the scanner:
python3 mongo_scanner.py
The script will prompt:
Enter target file name (default: targets.txt):
Options:
targets.txtprod_mongo.txtpython3 mongo_scanner.py
Enter target file name (default: targets.txt): prod_mongo.txt
[*] Using target file: prod_mongo.txt
[*] Total host:port pairs: 4
[*] Concurrency: 50 | Timeout: 5s
------------------------------------------------------------
[+] MongoDB OPEN: 10.99.1.52:3717
[-] 192.168.1.10:27017 - Not exposed
------------------------------------------------------------
[*] Done. Results saved to mongo_exposed_targets.txt
mongo_exposed_targets.txt
[2026-01-20 12:34:07] 10.99.1.52:3717 - Unauthenticated MongoDB exposed
[2026-01-20 12:34:07] dds-d9j6c3a7096ded641.mongodb.ap-southeast-5.rds.aliyuncs.com:3717 - Unauthenticated MongoDB exposed
| Status | Meaning |
|---|---|
MongoDB OPEN |
MongoDB service responded to hello |
Unauthenticated MongoDB exposed | Handshake allowed without auth |
Not exposed | Not MongoDB or auth/connection blocked |
Connection refused / timeout | Service not reachable |