Skip to content

LS-DB-002: MongoDB Connection String

Severity CRITICAL
Blast radius Full database compromise
Rotate at https://www.mongodb.com/docs/manual/tutorial/change-own-password-and-custom-data/

If this leaks

Contains a username and password for a MongoDB instance, granting full read/write access to every database and collection that user can reach.

What to do

  1. Rotate or revoke the credential at https://www.mongodb.com/docs/manual/tutorial/change-own-password-and-custom-data/.
  2. Check the provider's audit logs for use you don't recognise.
  3. Remove it from git history (leakscan purge --help) and load it from an environment variable or secret manager instead.

Pattern

mongodb(?:\+srv)?://[^\s'\"]+:[^\s'\"@]+@[^\s'\"]+

Suppress

On one line: # leakscan:ignore LS-DB-002. For the whole project:

disable_rules: [LS-DB-002]