Skip to main content

MongoDB

Description

The MongoDB connector connects to the host via SSH and uses mongosh to enumerate database users and their assigned roles from the admin database. It parses the JSON output from db.getSiblingDB('admin').getUsers() to discover all MongoDB users, their database context, and role assignments, classifying administrative roles such as root, dbAdmin, and clusterAdmin as privileged.

System Type Classification

FieldValue
System TypeInfrastructure
Default Scan Priority200

Version Support

OrbisID EditionSupported
CommunityNo
ProYes
EnterpriseYes

Supported Protocol

ProtocolPortNotes
SSH22 TCPSSH access to the MongoDB host

What OrbisID Discovers

DataSource
MongoDB usersdb.getSiblingDB('admin').getUsers() via mongosh
Role assignmentsroles array per user document
Database contextdb field per user
Privileged rolesroot, dbAdmin, userAdmin, clusterAdmin and variants

Connection Requirements

Required Permissions

The SSH credential must have access to a user that can run mongosh with MongoDB admin credentials.

Minimum permissions:

  • SSH login access to the MongoDB server
  • MongoDB user with readAnyDatabase + listUsers on the admin database

Credential Mapping

OrbisID FieldValue
credential.usernameSSH username (also used as the MongoDB admin user)
credential.passwordSSH password (also used as the MongoDB admin password)
system.hostnameMongoDB server hostname or IP
system.sshPortSSH port (default 22)
system.mongoPortMongoDB port (default 27017)

Network Requirements

The OrbisID server must have SSH access to the MongoDB host on port 22. MongoDB does not need to be directly accessible from the OrbisID server.

Configuration Steps

  1. Ensure mongosh is installed on the MongoDB host
  2. Create a dedicated MongoDB scanner account:
    db.getSiblingDB('admin').createUser({
    user: "orbisid-scanner",
    pwd: "<password>",
    roles: [{ role: "readAnyDatabase", db: "admin" },
    { role: "userAdminAnyDatabase", db: "admin" }]
    })
  3. Create a Credential in OrbisID:
    • Username: SSH username (with same MongoDB credentials)
    • Password: SSH / MongoDB password
  4. Navigate to Systems → Add System
  5. Fill in the fields:
FieldValue
NameDescriptive name (e.g., MongoDB – Production Cluster)
OS TypeMongodb
System TypeInfrastructure
HostnameMongoDB server hostname or IP
CredentialThe SSH + MongoDB credential
  1. Click Test Connection
  2. Click Save

Troubleshooting

SymptomLikely CauseResolution
Authentication failedInvalid SSH credentialsVerify SSH username and password
No users returnedMongoDB auth failure in mongoshVerify the MongoDB credentials match the SSH user
mongosh: command not foundmongosh not installedInstall mongosh on the MongoDB host
Empty outputInsufficient MongoDB permissionsGrant listUsers on the admin database