MongoDB Enterprise Advanced 8.x Security Technical Implementation Guide
Pick two releases to diff their requirements.
Open a previous version of this STIG.
- RMF Control
- AC-10
- Severity
- L
- CCI
- CCI-000054
- Version
- MD8X-00-000150
- Vuln IDs
-
- V-279331
- Rule IDs
-
- SV-279331r1179501_rule
Checks: C-83884r1179500_chk
Mongo can limit the total number of connections. Verify the MongoDB configuration file (default location: /etc/mongod.conf) contains the following: net: maxIncomingConnections: %int% If this parameter is not present, or the OS is not used to limit connections, this is a finding.
Fix: F-83789r1179437_fix
MongoDB can limit the total number of connections served by the mongod process by setting the following in the MongoDB configuration file (default location: /etc/mongod.conf): net: maxIncomingConnections: %int% Refer to the following documentation: https://www.mongodb.com/docs/manual/reference/configuration-options/ Products outside of MongoDB can be used to monitor database sessions and limit the maximum number of connections that can be made. Alternatively, most Unix-like operating systems, including Linux and macOS, provide ways to limit and control the usage of system resources such as threads, files, and network connections on a per-process and per-user basis. These ulimits prevent single users from using too many system resources. The following is the MongoDB documentation regarding these user limits: https://www.mongodb.com/docs/manual/reference/ulimit/.
- RMF Control
- AC-2
- Severity
- H
- CCI
- CCI-000015
- Version
- MD8X-00-000200
- Vuln IDs
-
- V-279332
- Rule IDs
-
- SV-279332r1179502_rule
Checks: C-83885r1179439_chk
Verify that the MongoDB configuration file (default location /etc/mongod.conf) contains the following: security: authorization: "enabled" If using OIDC for human users: Verify the MongoDB configuration file (default location: /etc/mongod.conf) contains the following: setParameter: authenticationMechanisms: "MONGODB-OIDC" oidcIdentityProviders: [ { issuer: "<Issuer URL from IdP>", audience: "<>", matchPattern: "<>", JWKSPollSecs: "<>" } ] If this parameter is not present, this is a finding. Refer to Security OIDC/OAuth 2.0 configuration documentation for additional details: https://www.mongodb.com/docs/manual/core/oidc/security-oidc/
Fix: F-83790r1179440_fix
Edit the MongoDB configuration file (default location /etc/mongod.conf) to include the following: security: authorization: "enabled" This will enable SCRAM-SHA-256 authentication (default). Instruction on configuring the default authentication is provided here: https://www.mongodb.com/docs/v8.0/tutorial/enable-authentication/ The high-level steps described by the above will require the following: 1. Start MongoDB without access control. 2. Connect to the instance. 3. Create the user administrator. 4. Restart the MongoDB instance with access control. 5. Connect and authenticate as the user administrator. 6. Create additional users as needed for the deployment. For OIDC, edit the MongoDB configuration file (default location /etc/mongod.conf) to include the following: setParameter: authenticationMechanisms: "MONGODB-OIDC" oidcIdentityProviders: [ { issuer: "<Issuer URL from IdP>", audience: "<>", matchPattern: "<>", JWKSPollSecs: "<>" } ] Configuration information for OIDC for MongoDB can be found here: https://www.mongodb.com/docs/manual/core/oidc/workforce/configure-oidc/#std-label-configure-oidc. Configuration information for OAuth 2.0 for MongoDB can be found here: https://www.mongodb.com/docs/manual/core/oidc/workload/configure-mongodb-workload/#std-label-configure-mongodb-workload.
- RMF Control
- AC-3
- Severity
- H
- CCI
- CCI-000213
- Version
- MD8X-00-000300
- Vuln IDs
-
- V-279333
- Rule IDs
-
- SV-279333r1179443_rule
Checks: C-83886r1179164_chk
The MongoDB administrator must ensure that additional application access control is enforced. Review the system documentation to determine the required levels of protection for MongoDB server securables by type of login. Review the permissions actually in place on the server. Run the command to view roles and privileges in a particular <database> : use <database> db.getRoles( { rolesInfo: 1, showPrivileges: true, showBuiltinRoles: true } ) If the permissions do not match the documented requirements, this is a finding.
Fix: F-83791r1179442_fix
Use the following statements to add and remove permissions on MongoDB server securables, bringing them in line with the documented requirements: createRole(), updateRole(), dropRole(), grantRolesToUser() MongoDB commands for role management can be found here: https://www.mongodb.com/docs/v8.0/reference/method/js-role-management/
- RMF Control
- AU-10
- Severity
- M
- CCI
- CCI-000166
- Version
- MD8X-00-000400
- Vuln IDs
-
- V-279334
- Rule IDs
-
- SV-279334r1179504_rule
Checks: C-83887r1179167_chk
Check the MongoDB configuration file (default location /etc/mongod.conf) for a key named "auditLog:". Examples shown below: auditLog: destination: file format: BSON path: <mongodb audit log directory>/auditLog.bson filter: '{ atype: { $in: [ "createCollection", "dropCollection" ] } }' -OR- auditLog: destination: syslog If an "auditLog:" key is not present, this is a finding. If the "auditLog:" key is present, ensure the subkey of "destination:" is set to either "file" or "syslog". If not, this is a finding. If the "auditLog:" key is present and contains a subkey of "filter:", ensure the filter is valid. If the filter is invalid, this is a finding. The site auditing policy must be reviewed to determine if the "filter:" being applied meets the site auditing requirements. If not, this is a finding. Check the MongoDB configuration file (default location: /etc/mongod.conf) for the following entry: setParameter: auditAuthorizationSuccess: true If this setParameter entry does not have "auditAuthorizationSuccess: true", this is a finding.
Fix: F-83792r1179503_fix
Edit the MongoDB configuration file (default location /etc/mongod.conf) and add a configured "auditLog" setting: auditLog: destination: file format: BSON path: <mongodb audit log directory>/auditLog.bson -OR- auditLog: destination: syslog Add the following entry to the MongoDB configuration file: setParameter: auditAuthorizationSuccess: true Restart the MongoDB service from the OS. $ sudo systemctl restart mongod Setting of auditAuthorizationSuccess enables auditing of authorization success for the authCheck action. The parameter value must be true to audit read and write operations. However, when auditAuthorizationSuccess is false, auditing has less performance impact because the audit system only logs authorization failures. If the "auditLog" setting was present and contained a "filter:" parameter, ensure the "filter:" expression does not prevent the auditing of events that should be audited. The filter can be modified accordingly to ensure it complies. Alternatively, remove the "filter:" parameter to enable auditing for all events. Refer to the MongoDB documentation for details of audit operations and event configuration: https://www.mongodb.com/docs/v8.0/core/auditing/ https://www.mongodb.com/docs/v8.0/tutorial/configure-audit-filters/
- RMF Control
- AU-9
- Severity
- M
- CCI
- CCI-000164
- Version
- MD8X-00-002000
- Vuln IDs
-
- V-279336
- Rule IDs
-
- SV-279336r1179505_rule
Checks: C-83889r1179173_chk
MongoDB must not permit access to its audit logs by unprivileged users. The official installation packages restrict which operating system users and groups may read or modify files. The audit log destination is not configured or created at installation time and must be manually done with appropriate ownership and permissions applied with the MongoDB user and MongoDB group. Check the MongoDB configuration file (default location /etc/mongod.conf) for a key named "auditLog:" with "destination" set to "file". Example shown below: auditLog: destination: file format: BSON path: <MongoDB auditLog directory>/auditLog.bson If "auditLog" does not exist this is a finding. If the auditLog.destination is "file" in the MongoDB configuration file (default location /etc/mongod.conf) then the following will check ownership and permissions of the MongoDB auditLog directory: Verify User ownership, Group ownership, and permissions on the "<MongoDB auditLog directory>": $ stat <MongoDB auditLog directory> If the User owner is not "mongod", this is a finding. If the Group owner is not "mongod", this is a finding. If the directory is more permissive than "600", this is a finding. To find the auditLog directory name, view and search for the entry in the MongoDB configuration file (default location /etc/mongod.conf) for auditLog.destination. If this parameter's value is "file", then use the directory portion of the auditLog.path setting as the MongoDB auditLog directory location. Example: auditLog: destination: file format: BSON path: /var/log/mongodb/audit/auditLog.bson Given the example above, to find the auditLog directory ownership and permissions, run the following command: > stat /var/log/mongodb/audit The output will look similar to the following: File: '/var/log/mongodb/audit' Size: 48 Blocks: 0 IO Block: 4096 directory Device: 808h/2056d Inode: 245178 Links: 2 Access: (0600/drw-------) Uid: ( 997/ mongod) Gid: ( 996/ mongod) Context: unconfined_u:object_r:mongod_log_t:s0 Access: 2020-03-16 12:51:16.816000000 -0400 Modify: 2020-03-16 12:50:48.722000000 -0400 Change: 2020-03-16 12:50:48.722000000 -0400 Birth: -
Fix: F-83794r1179174_fix
It is recommended to use the official installation packages provided by MongoDB. In the event the software was installed manually and permissions need to be restricted, consider a clean reinstallation. To correct a finding where auditLog.destination is set to "file", run these commands: $ chown mongod <MongoDB auditLog directory> $ chgrp mongod <MongoDB auditLog directory> $ chmod 600 <MongoDB auditLog directory> The path for the MongoDB auditLog directory will vary according to local circumstances. The auditLog directory will be found in the MongoDB configuration file, whose default location is /etc/mongod.conf. To find the auditLog directory name, view and search for the entry in the MongoDB configuration file for the auditLog.path: Example: auditLog: destination: file format: BSON path: /var/log/mongodb/audit/auditLog.bson Given the example above, the "MongoDB auditLog directory" is "/var/log/mongodb/audit".
- RMF Control
- AU-9
- Severity
- M
- CCI
- CCI-001495
- Version
- MD8X-00-002300
- Vuln IDs
-
- V-279337
- Rule IDs
-
- SV-279337r1179178_rule
Checks: C-83890r1179176_chk
To ensure audit configurations are protected from unauthorized access, modification, and removal, the default installation of MongoDB restricts permission on the configuration file. Verify User ownership, Group ownership, and permissions on the <MongoDB configuration file>: Note: Default name and location is: /etc/mongod.conf. The name and location for the MongoDB configuration file will vary according to local circumstances. Using the default name and location the command would be: $ stat /etc/mongod.conf If the User owner is not "mongod", this is a finding. If the Group owner is not "mongod", this is a finding. If the filename is more permissive than "600", this is a finding. Note that the audit destination cannot be modified at runtime.
Fix: F-83795r1179177_fix
Run these commands: "chown mongod <MongoDB configuration file>" "chgrp mongod <MongoDB configuration file>" "chmod 600 <MongoDB configuration file>" Note: The name and location for the MongoDB configuration file will vary according to local circumstances. The default name and location is /etc/mongod.conf. Using the default name and location the commands would be: $ chown mongod /etc/mongod.conf $ chgrp mongod /etc/mongod.conf $ chmod 600 /etc/mongod.conf
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001499
- Version
- MD8X-00-002400
- Vuln IDs
-
- V-279338
- Rule IDs
-
- SV-279338r1179445_rule
Checks: C-83891r1179179_chk
Review monitoring procedures and implementation evidence to verify monitoring of changes to database software libraries, related applications, and configuration files occurs. Verify the list of files, directories, and database application objects (procedures, functions, and triggers) being monitored is complete. There are many possible options to monitor the database. The most common are making use of a monitoring tool or running a script periodically. If a monitoring tool is actively being used to monitor the database and there is proof of the tool being active, this is not a finding. Where monitoring is implemented by running a Bash shell script (either scheduled or on demand), the script should check the current SHA-256 checksum of the MongoDB files with the original SHA-256 checksum after installation and configuration. Create and run the following shell script "check_mongodb_256sha_hashes.sh" from its containing Linux directory as a system administrator. $ ./check_mongodb_256sha_hashes.sh If the output is not the following, this is a finding: "No changes detected in the monitored files." The shell script file "check_mongodb_2456sha_hashes.sh" is as follows: # filename: check_mongodb_256sha_hashes.sh #!/bin/bash # Function to compute SHA-256 hash of the specified file file_hash() { sha256sum "$1" | awk '{print $1}' } # Function to check the list of files for any changes based on their SHA-256 hashes check_files() { local changed=0 declare -A stored_hashes # Try to load last known hashes if [ -f file_hashes.txt ]; then while IFS=: read -r file hash; do stored_hashes["$file"]=$hash done < file_hashes.txt fi # Check each file's hash against stored hashes for file in "$@"; do if [ -f "$file" ]; then current_hash=$(file_hash "$file") if [[ "${stored_hashes[$file]}" != "$current_hash" ]]; then if [[ -n "${stored_hashes[$file]}" ]]; then echo "Change detected in $file" else echo "New file added or first time hashing: $file" fi changed=1 stored_hashes["$file"]=$current_hash fi else echo "Warning: $file does not exist." fi done # Save the updated hashes > file_hashes.txt for file in "${!stored_hashes[@]}"; do echo "$file:${stored_hashes[$file]}" >> file_hashes.txt done if [ "$changed" -eq 0 ]; then echo "No changes detected in the monitored files." fi } # List of files to monitor files_to_check=( "/etc/mongod.conf" "/usr/bin/mongod" "/usr/bin/mongos" "/usr/bin/mongosh" "/usr/bin/mongocryptd" "/usr/bin/mongodecrypt" "/usr/bin/mongodump" "/usr/bin/mongoexport" "/usr/bin/mongofiles" "/usr/bin/mongoimport" "/usr/bin/mongokerberos" "/usr/bin/mongoldap" "/usr/bin/mongorestore" "/usr/bin/mongostat" "/usr/bin/mongotop" ) # Invoke check_files function with the list of files check_files "${files_to_check[@]}"
Fix: F-83796r1179444_fix
Implement procedures to monitor for unauthorized changes to DBMS software libraries, related software application libraries, and configuration files. If a third-party automated tool is not employed, an automated job that reports file information on the directories and files of interest and compares them to the baseline report for the same will meet the requirement. Examples of such products are Puppet, Chef, or Ansible. Alternately, users can write scripts to inspect the database software libraries, related applications, and configuration files to detect changes and to take appropriate actions or notifications if changes are detected. Use file hashes or checksums for comparisons, as file dates may be manipulated by malicious users. For example, if the running of the monitoring shell script "check_mongodb_256sha_hashes.sh" shown in the "Check" returned the following: $ ./check_mongodb_256sha_hashes.sh "Change detected in /etc/mongod.conf" For each file in which a change has been detected, investigate the possible causes of the change for that file. In this case, inspect the "/etc/mongod.conf" file for changes in its content.
- RMF Control
- CM-5
- Severity
- H
- CCI
- CCI-001499
- Version
- MD8X-00-002500
- Vuln IDs
-
- V-279339
- Rule IDs
-
- SV-279339r1179184_rule
Checks: C-83892r1179182_chk
To ensure log, network, security, and other audit configurations are not modifiable by unauthorized operating system users, the default installation of MongoDB restricts permission on the configuration file. Verify User ownership, Group ownership, and permissions on the "<MongoDB configuration file>": (default name and location is /etc/mongod.conf) Using the default name and location the command would be: $ stat /etc/mongod.conf If the User owner is not "mongod", this is a finding. If the Group owner is not "mongod", this is a finding. If the filename is more permissive than "600", this is a finding. Note that the audit destination cannot be modified at runtime.
Fix: F-83797r1179183_fix
It is recommended to use the official installation packages provided by MongoDB. In the event the software was installed manually, and permissions need to be restricted, consider a clean reinstallation. Alternatively, run the following commands to properly set permissions on the configuration file: $ chown mongod <MongoDB configuration file> $ chgrp mongod <MongoDB configuration file> $ chmod 600 <<MongoDB configuration file> The name and location for the MongoDB configuration file will vary according to local circumstances. The default name and location is /etc/mongod.conf. Using the default name and location the commands would be: $ chown mongod /etc/mongod.conf $ chgrp mongod /etc/mongod.conf $ chmod 600 /etc/mongod.conf
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001499
- Version
- MD8X-00-002600
- Vuln IDs
-
- V-279340
- Rule IDs
-
- SV-279340r1179187_rule
Checks: C-83893r1179185_chk
By default MongoDB, runs using "mongod" user account (both user and group) and uses the following default directories: MongoDB created directories (default): /var/lib/mongo (the data directory) +-- diagnostic.data +-- _tmp +-- journal /var/log/mongodb (the mongod process log directory) +-- audit (the auditLog directory) Standard directories: /bin (the executable directory) /etc (the configuration file directory) Check if any non-MongoDB application, non-MongoDB data, or non-MongoDB directories exists under any of the MongoDB-created directories or subdirectories. If any non-MongoDB application, non-MongoDB data, or non-MongoDB directories exists under the MongoDB-created directories, this is a finding.
Fix: F-83798r1179186_fix
The official installation packages from MongoDB segregate MongoDB executable software from MongoDB data directories by default. For any non-MongoDB application found, reinstall that application to use directories that are not under the MongoDB created directories. For any non-MongoDB application that stores data under the MongoDB-created directories, reinstall the application and configure the application to use non-MongoDB-created directories to store its data. For any non-MongoDB data found under the MongoDB-created directories that cannot be associated with a MongoDB application, either move or delete that data from the MongoDB-created directories.
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001499
- Version
- MD8X-00-002700
- Vuln IDs
-
- V-279341
- Rule IDs
-
- SV-279341r1179506_rule
Checks: C-83894r1179188_chk
For each database in MongoDB, run the following commands: use <database> db.getUsers() Example output: { _id: 'admin.user1', userId: UUID('b78e490a-4661-491f-8197-c3251934e785'), user: 'user1', db: 'admin', roles: [ { role: 'readWrite', db: 'myDatabase' }, { role: 'dbOwner', db: 'myDatabase' }, { role: 'dbOwner', db: 'anotherDatabase' } ] Here, the user named "user1" in the "admin" database has a role of "dbOwner" for the database (db:) "myDatabase" and the database (db:) "anotherDatabase". For users where the role of "dbOwner" is found, verify with the organization or site-specific documentation whether the user is authorized for the "dbOwner" role on the database resources listed. If the user account has the role of "dbOwner" but is not authorized for the role for any database listed in their output, this is a finding.
Fix: F-83799r1179189_fix
For each user identified as having a "dbOwner" role on a database they are not authorized for, revoke the "dbOwner" role from that user on that database by running the following commands: use <database> db.revokeRolesFromUser() command https://www.mongodb.com/docs/v8.0/reference/command/revokeRolesFromUser/ Example to revoke "dbOwner" role from "user1" on the "anotherDatabase" in the "admin" database: use admin db.revokeRolesFromUser( "user1", [ { role: "dbOwner", db: "anotherDatabase" } ] )
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001499
- Version
- MD8X-00-002800
- Vuln IDs
-
- V-279342
- Rule IDs
-
- SV-279342r1179447_rule
Checks: C-83895r1179446_chk
For each database in MongoDB, run the following command to obtain the roles: use <database> db.getRoles( { rolesInfo: 1, showPrivileges:true, showBuiltinRoles: true } ) Run the following command to the roles assigned to users: use admin db.system.users.find() Analyze the output and if any roles or users have unauthorized access, this is a finding. This will vary on an application basis.
Fix: F-83800r1179192_fix
Use the following commands to remove unauthorized access to a MongoDB database: db.revokePrivilegesFromRole() db.revokeRolesFromUser() MongoDB commands for role management can be found here: https://www.mongodb.com/docs/v8.0/reference/method/js-role-management/
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000381
- Version
- MD8X-00-003000
- Vuln IDs
-
- V-279344
- Rule IDs
-
- SV-279344r1179199_rule
Checks: C-83897r1179197_chk
MongoDB operations permit arbitrary JavaScript expressions to be run directly on the server. If the following parameter is not present or not set as show below in the MongoDB configuration file (default location: /etc/mongod.conf), this is a finding. security: javascriptEnabled: false
Fix: F-83802r1179198_fix
Disable the "javascriptEnabled" option. Edit the MongoDB configuration file (default location: /etc/mongod.conf) to include the following: security: javascriptEnabled: false
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000382
- Version
- MD8X-00-003300
- Vuln IDs
-
- V-279346
- Rule IDs
-
- SV-279346r1179449_rule
Checks: C-83899r1179448_chk
Check the MongoDB configuration file (default location /etc/mongod.conf) to verify the following entry: net: port: 27017 If the port listed is not authorized, this is a finding. Verify only TLS 1.2+ is being used. If the following entry is not in the configuration file, this is a finding. net: tls: mode: requireTLS disabledProtocols: TLS1_0,TLS1_1 Verify the binding of IP addresses does not include "0.0.0.0" or ":0": net: bindIp: 127.0.0.1,<specific-ip-addresses> If the bindIp contains "0.0.0.0" or "::0", this is a finding.
Fix: F-83804r1179204_fix
Check the MongoDB configuration file (default location /etc/mongod.conf): Ensure the following section exists and set the port in the to an allowed port: net: port: 27017 Ensure that TLS 1.2+ is being used by adding the following entry into the configuration file. net: tls: mode: requireTLS disabledProtocols: TLS1_0,TLS1_1 Ensure the following section exists in the configuration file and that it does not contain wildcard binding (occurrences of "0.0.0.0" or "::0" or equivalents). net: bindIp: 127.0.0.1,<specific-ip-addresses>
- RMF Control
- IA-2
- Severity
- M
- CCI
- CCI-000764
- Version
- MD8X-00-003400
- Vuln IDs
-
- V-279347
- Rule IDs
-
- SV-279347r1179208_rule
Checks: C-83900r1179206_chk
For each database in the system, run the following command: > use <database> > db.getUsers() Verify each user identified is a member of an appropriate organization that can access the database. Alternatively, if LDAP/AD is being used for authentication/authorization, the mongoldap tool can be used to verify user account access. If a user is found not be a member of an appropriate organization that can access the database, this is a finding. Verify the MongoDB configuration file (default location /etc/mongod.conf) contains the following: security: authorization: "enabled" If this parameter is not present, this is a finding.
Fix: F-83805r1179207_fix
For any user that is not a member of an appropriate organization and that has access to a database in the system, run the following command: // Change to the appropriate database > use <database> > db.dropUser("<username>", {w: "majority", wtimeout: 5000}) The MongoDB configuration file (default location /etc/mongod.conf) must contain the following: security: authorization: "enabled" If not, edit the MongoDB configuration file. Add the parameters and stop/start (restart) any mongod or mongos process using this MongoDB configuration file.
- RMF Control
- Severity
- H
- CCI
- CCI-004062
- Version
- MD8X-00-003600
- Vuln IDs
-
- V-279349
- Rule IDs
-
- SV-279349r1179508_rule
Checks: C-83902r1179507_chk
MongoDB supports the Salted Challenge Response Authentication Mechanism (SCRAM) as the default authentication mechanism for MongoDB. Run the following script for database in the MongoDB system: /// Connect to admin database db = db.getSiblingDB('admin'); // Get all users without SCRAM-SHA-256 const allUsers = db.system.users.find().toArray(); const usersToUpgrade = allUsers.filter(user => !user.credentials || !user.credentials["SCRAM-SHA-256"] ); print(`Found ${usersToUpgrade.length} users without SCRAM-SHA-256 authentication`); if (usersToUpgrade.length === 0) { print("All users already using SCRAM-SHA-256. No action needed."); quit(); } // Display users that need upgrading print("\nUsers needing upgrade to SCRAM-SHA-256:"); usersToUpgrade.forEach(user => { print(`- User: ${user.user}, Database: ${user.db}`); }); If any user found in a database using password authentication does not have "Using SCRAM-SHA-256: YES", this is a finding.
Fix: F-83807r1179451_fix
For each user that does not have SCRAM-SHA-256, run the following command: use admin db.runCommand({'updateUser':'<their username>',pwd: passwordPrompt() , mechanisms:['SCRAM-SHA-256']})
- RMF Control
- IA-5
- Severity
- H
- CCI
- CCI-000197
- Version
- MD8X-00-003700
- Vuln IDs
-
- V-279350
- Rule IDs
-
- SV-279350r1179454_rule
Checks: C-83903r1179215_chk
In the MongoDB database configuration file (default location /etc/mongod.conf), verify the following parameters in the "net.tls" (network TLS) section of the file: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/server.pem CAFile: /etc/ssl/ca.crt allowInvalidCertificates: false allowConnectionsWithoutCertificates: false If the "net.tls" parameter is not present, this is a finding. If the "net.tls.certificateKeyFile" parameter is not present, this is a finding. If the "net.tls.CAFile" parameter is not present, this is a finding. If the "net.tls.allowInvalidCertificates" parameter is found and set to "true", this is a finding. If the "net.tls.allowConnectionsWithoutCertificates" parameter is found and set to "true", this is a finding.
Fix: F-83808r1179453_fix
In the MongoDB database configuration file (default location /etc/mongod.conf), ensure the following parameters are present in the "net.tls" (network TLS) section of the file and are configured correctly for the site and server: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/server.pem CAFile: /etc/ssl/ca.crt allowInvalidCertificates: false allowConnectionsWithoutCertificates: false Restart the MongoDB service from the OS. $ sudo systemctl restart mongod More information for configuring TLS/SSL for MongoDB can be found here: https://www.mongodb.com/docs/manual/tutorial/configure-ssl/
- RMF Control
- IA-5
- Severity
- H
- CCI
- CCI-000186
- Version
- MD8X-00-003900
- Vuln IDs
-
- V-279351
- Rule IDs
-
- SV-279351r1179509_rule
Checks: C-83904r1179455_chk
In the MongoDB database configuration file (default location /etc/mongod.conf), review the following parameters: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/mongodbca.pem Verify ownership, group ownership, and permissions for the MongoDB config file (default /etc/mongod.conf), the certificateKeyFile (default /etc/ssl/mongodb.pem), and the CAFile (default /etc/ssl/mongodbca.pem). For each file, run following command and review its output: ls -al <filepath> Example output: -rw------- 1 mongod mongod 566 Apr 26 20:20 <filepath> If the user owner is not "mongod", this is a finding. If the group owner is not "mongod", this is a finding. If the file is more permissive than "600", this is a finding.
Fix: F-83809r1179219_fix
Run these commands: chown mongod:mongodb /etc/ssl/mongodb.pem chmod 600 /etc/ssl/mongodb.pem chown mongod:mongod /etc/ssl/mongodbca.pem chmod 600 /etc/ssl/mongodbca.pem
- RMF Control
- IA-5
- Severity
- M
- CCI
- CCI-000187
- Version
- MD8X-00-004000
- Vuln IDs
-
- V-279352
- Rule IDs
-
- SV-279352r1179459_rule
Checks: C-83905r1179457_chk
Note: This is not applicable if using LDAP for authentication. Each unique x.509 client certificate corresponds to a single MongoDB user; meaning a single client certificate cannot authenticate more than one MongoDB user. Log in to MongoDB and run the following command: > db.runCommand( {connectionStatus: 1} ); Example output: > db.runCommand({connectionStatus:1}).authInfo { "authenticatedUsers" : [ { "user" : "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry", "db" : "mydb1" } ], "authenticatedUserRoles" : [ { "role" : "dbOwner", "db" : "mydb1" } ] } If the authenticated MongoDB user displayed does not have a user value equal to the x.509 certificate subject name, this is a finding.
Fix: F-83810r1179458_fix
Add x.509 certificate subject as an authorized user. To authenticate with a client certificate, first add the value of the subject from the client certificate as a MongoDB user. Each unique x.509 client certificate corresponds to a single MongoDB user; meaning a single client certificate cannot authenticate more than one MongoDB user. Note: The RDNs in the subject string must be compatible with the RFC2253 standard. Retrieve the RFC2253 formatted subject from the client certificate with the following command: $ openssl x509 -in <pathToClient PEM> -inform PEM -subject -nameopt RFC2253 The command returns the subject string as well as certificate: subject= CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry -----BEGIN CERTIFICATE----- # ... -----END CERTIFICATE----- Add the RFC2253 compliant value of the subject as a user. Omit spaces as needed. For example, in the mongo shell, to add the user with both the "readWrite" role in the test database and the "userAdminAnyDatabase" role, which is defined only in the admin database: > db.getSiblingDB("$external").runCommand( { createUser: "CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry", roles: [ { role: 'readWrite', db: 'test' }, { role: 'userAdminAnyDatabase', db: 'admin' } ], writeConcern: { w: "majority" , wtimeout: 5000 } } ) In the above example, to add the user with the "readWrite" role in the test database, the role specification document specified "test" in the "db" field. To add "userAdminAnyDatabase" role for the user, the above example specified "admin" in the "db" field. Note: Some roles are defined only in the admin database, including clusterAdmin, readAnyDatabase, readWriteAnyDatabase, dbAdminAnyDatabase, and userAdminAnyDatabase. To add a user with these roles, specify "admin" in the "db" field. Refer to Manage Users and Roles for details on adding a user with roles. To remove a user that is not authorized, run the following command: > use $external > db.dropUser("<RDN of user>")
- RMF Control
- IA-6
- Severity
- H
- CCI
- CCI-000206
- Version
- MD8X-00-004100
- Vuln IDs
-
- V-279353
- Rule IDs
-
- SV-279353r1179226_rule
Checks: C-83906r1179224_chk
Restrict the environment to tools which meet this requirement. For the MongoDB command-line tools mongo shell "mongosh", "mongodump", "mongorestore", "mongoimport", "mongoexport", which cannot be configured not to obfuscate a plain-text password, and any other essential tool with the same limitation, verify the system documentation explains the need for the tool, who uses it, any relevant mitigations and that authorizing official (AO) approval has been obtained. If it is not documented, this is a finding. Request evidence that all users of these MongoDB command-line tools are trained in the use of the "-p" or "--password" option plain-text password option and how to keep the password protected from unauthorized viewing/capture and that they adhere to this practice. If evidence of training does not exist, this is a finding.
Fix: F-83811r1179225_fix
For the mongo shell "mongosh", "mongodump", "mongorestore", "mongoimport", "mongoexport", which can accept a plain-text password, and any other essential tool with the same limitation: - Document the need for it, who uses it, and any relevant mitigations, and obtain AO approval. - Train all users of the tool in the nature of using the plain-text password option and in how to keep the password protected from unauthorized viewing/capture and document they have been trained. To view the acceptable command line flags, execute the commands with --help for the various parameters that can be used. For example: mongosh --help Example output: mongosh Authentication Options: -u, --username [arg] Username for authentication -p, --password [arg] Password for authentication
- RMF Control
- IA-7
- Severity
- H
- CCI
- CCI-000803
- Version
- MD8X-00-004200
- Vuln IDs
-
- V-279354
- Rule IDs
-
- SV-279354r1179510_rule
Checks: C-83907r1179460_chk
Verify that FIPSMode: true is configured in the mongod.conf file (default location /etc/mongod.conf) as shown below: net: tls: FIPSMode: true If net.tls.FIPSMode is not present or not configured as shown above in the MongoDB configuration file, this is a finding. Alternatively, run the following command from the MongoDB shell: > db.getSiblingDB("admin").runCommand({getCmdLineOpts: 1}).parsed.net.tls.FIPSMode If the server is running with FIPS mode, this command will return "true". Any other output or no output is a finding. Verify FIPS has been enabled at the OS level. Refer to the OS-specific documentation on how to verify.
Fix: F-83812r1179228_fix
Enable FIPS mode for MongoDB Enterprise. Edit the MongoDB database configuration file (default location /etc/mongod.conf) to contain the following parameter setting: net: tls: FIPSMode: true Restart the MongoDB service from the OS. $ sudo systemctl restart mongod For the operating system finding, refer to the appropriate operating system documentation for the procedure to install, configure, and test FIPS mode.
- RMF Control
- SC-2
- Severity
- M
- CCI
- CCI-001082
- Version
- MD8X-00-004400
- Vuln IDs
-
- V-279355
- Rule IDs
-
- SV-279355r1179463_rule
Checks: C-83908r1179462_chk
MongoDB grants access to data and commands through role-based authorization and provides built-in roles that provide the different levels of access commonly needed in a database system. User-defined roles can also be created. Check a user's role to verify correct privileges for the function. Prerequisite: To view a user's roles, users must have the "viewUser" privilege. Connect to MongoDB. For each database in the system, identify the user's roles for the database: use <database> db.getUser("[username]") The server will return a document with the user's roles. View a role's privileges. Prerequisite: To view a user's roles, users must have the "viewUser" privilege. For each database, identify the privileges granted by a role: use <database> db.getRole( "read", { showPrivileges: true } ) The server will return a document with the "privileges" and "inheritedPrivileges" arrays. The "privileges returned" document lists the privileges directly specified by the role and excludes those privileges inherited from other roles. The "inheritedPrivileges" returned document lists all privileges granted by this role, both directly specified and inherited. If the role does not inherit from other roles, the two fields are the same. If a user has a role with inappropriate privileges, this is a finding.
Fix: F-83813r1179231_fix
Administrators using MongoDB should document the appropriate privileges for various roles appropriate to the application. Prerequisite: To view a user's roles, users must have the "viewUser" privilege. Connect to MongoDB. For each database, identify the user's roles for the database. use <database> db.getUser("[username]") The server will return a document with the user's roles. To revoke a user's role from a database, use the db.revokeRolesFromUser() method. To grant a role to a user, use the db.grantRolesToUser() method.
- RMF Control
- SC-23
- Severity
- M
- CCI
- CCI-001188
- Version
- MD8X-00-004700
- Vuln IDs
-
- V-279358
- Rule IDs
-
- SV-279358r1179465_rule
Checks: C-83911r1179239_chk
Check the MongoDB configuration file (default location /etc/mongod.conf). The following option must be present ( "net.tls.mode") and set to "requireTLS": net: tls: mode: requireTLS If this is not found in the MongoDB configuration file, this is a finding.
Fix: F-83816r1179464_fix
Edit the MongoDB configuration file to ensure the "net.tls.mode" option is included and set to the value "requireTLS" as shown below: net: tls: mode: requireTLS Restart the MongoDB service from the OS. $ sudo systemctl restart mongod Further documentation is available at: https://www.mongodb.com/docs/v8.0/tutorial/configure-ssl/
- RMF Control
- SC-28
- Severity
- H
- CCI
- CCI-001199
- Version
- MD8X-00-005000
- Vuln IDs
-
- V-279361
- Rule IDs
-
- SV-279361r1179250_rule
Checks: C-83914r1179248_chk
To provide integrity and confidentiality for data at rest, MongoDB must be configured to use the Encrypted Storage Engine. Run the following command to verify whether or not the Encrypted Storage Engine is enabled: > db.serverStatus().encryptionAtRest.encryptionEnabled Any output other than "true" is a finding. Validate whether the Encrypted Storage Engine is running with an AEAD block cipher, which provides integrity, by running the following command: > db.serverStatus().encryptionAtRest.encryptionCipherMode Any response other than "AES256-GCM" is a finding. Validate the system is configured to use KMIP to obtain a master encryption key, rather than storing the master key on the local filesystem. Run: > db.serverStatus().encryptionAtRest.encryptionKeyId If the response is "local" or no response, this is a finding.
Fix: F-83819r1179249_fix
Enable the Encrypted Storage Engine with KMIP as the key storage mechanism and AES256-GCM as the encryption mode. Consult MongoDB documentation for encryption setup instruction here: https://www.mongodb.com/docs/v8.0/tutorial/configure-encryption/
- RMF Control
- SC-4
- Severity
- M
- CCI
- CCI-001090
- Version
- MD8X-00-005200
- Vuln IDs
-
- V-279363
- Rule IDs
-
- SV-279363r1179256_rule
Checks: C-83916r1179254_chk
Review the procedures for the refreshing of development/test data from production. Review any scripts or code that exists for the movement of production data to development/test systems, or to any other location or for any other purpose. Verify that copies of production data are not left in unprotected locations. If the code that exists for data movement does not comply with the organization-defined data transfer policy and/or fails to remove any copies of production data from unprotected locations, this is a finding.
Fix: F-83821r1179255_fix
Modify any code used for moving data from production to development/test systems to comply with the organization-defined data transfer policy, and to ensure copies of production data are not left in unsecured locations.
- RMF Control
- SC-4
- Severity
- M
- CCI
- CCI-001090
- Version
- MD8X-00-005400
- Vuln IDs
-
- V-279364
- Rule IDs
-
- SV-279364r1179259_rule
Checks: C-83917r1179257_chk
By default, the MongoDB official installation packages restrict user and group ownership and read/write permissions on the underlying data files and critical configuration files from other operating system users. In addition, process and memory isolation is used by default. System administrators should also consider if whole database encryption would be an effective control on an application basis. Run the following commands to verify proper permissions for the following database files or directories: $ stat /etc/mongod.conf If the owner and group are not both "mongod", this is a finding. If the file permissions are more permissive than "600", this is a finding. $ stat /var/lib/mongo If the owner and group are not both "mongod", this is a finding. If the file permissions are more permissive than "755", this is a finding. $ ls -l /var/lib/mongo If the owner and group of any file or sub-directory is not "mongod", this is a finding. If the permission of any file in the main directory (/var/lib/mongo) or sub-directory of (/var/lib/mongo) is more permissive than "600", this is a finding. If the permission of any sub-directory of (/var/lib/mongo) is more permissive than "700", this is a finding.
Fix: F-83822r1179258_fix
Correct the permission to the files and/or directories that are in violation. MongoDB Configuration file (default location /etc/mongod.conf): $ chown mongod:mongod /etc/mongod.conf $ chmod 600 /etc/mongod.conf MongoDB datafiles and directories (default location /var/lib/mongo): $ chown -R mongod:mongod /var/lib/mongo $ chmod 755 /var/lib/mongo $ find /var/lib/mongo/* -type f | xargs chmod 600 $ find /var/lib/mongo/* -type d | xargs chmod 700
- RMF Control
- SI-10
- Severity
- M
- CCI
- CCI-001310
- Version
- MD8X-00-005500
- Vuln IDs
-
- V-279365
- Rule IDs
-
- SV-279365r1179467_rule
Checks: C-83918r1179260_chk
As a client program assembles a query in MongoDB, it builds a BSON object, not a string. Thus, traditional SQL injection attacks are not a problem. However, MongoDB operations permit arbitrary JavaScript expressions to be run directly on the server. To check, run the following command from the MongoDB shell: > db.col.find({ $where: "return true;"} ) If the response does not return an error, this is a finding. If javascript has been correctly disabled, the correct error would indicate that the javascript global engine has been disabled. For example: MongoServerError: no globalScriptEngine in $where parsing}
Fix: F-83823r1179466_fix
Disable the javascriptEnabled option in the MongoDB configuration file (default location /etc/mongod.conf) to include the following: security: javascriptEnabled: false If document validation is needed, it must be configured according to the documentation page at: https://www.mongodb.com/docs/v8.0/core/schema-validation/
- RMF Control
- SI-10
- Severity
- M
- CCI
- CCI-001310
- Version
- MD8X-00-005600
- Vuln IDs
-
- V-279366
- Rule IDs
-
- SV-279366r1179512_rule
Checks: C-83919r1179263_chk
MongoDB operations permit arbitrary JavaScript expressions to be run directly on the server. If the following parameter is not present or not set as show below in the MongoDB configuration file (default location /etc/mongod.conf), this is a finding. security: javascriptEnabled: false
Fix: F-83824r1179264_fix
Disable the "javascriptEnabled" option. Edit the MongoDB configuration file (default location /etc/mongod.conf) to include the following: security: javascriptEnabled: false
- RMF Control
- SI-11
- Severity
- M
- CCI
- CCI-001312
- Version
- MD8X-00-005800
- Vuln IDs
-
- V-279367
- Rule IDs
-
- SV-279367r1179513_rule
Checks: C-83920r1179266_chk
Check custom application code to verify error messages do not contain information beyond what is needed for troubleshooting the issue. If custom application error messages contain PII data, sensitive business data, or information useful for identifying the host system or database structure, this is a finding. For example, when attempting to log in using the MongoDB shell with incorrect client credentials, the user will receive a generic error message that the authentication failed regardless of whether the user exists. If a user is attempting to perform an operation using the MongoDB shell for which they do not have privileges, MongoDB will return a generic error message that the operation is not authorized. To prevent too much information being displayed in the MongoDB logfiles, run the following command: > db.getSiblingDB("admin").runCommand({getCmdLineOpts: 1}).parsed.security.redactClientLogData If the command does not return true, this is a finding.
Fix: F-83825r1179468_fix
Configure custom application code so as not to divulge sensitive information or information useful for system identification in custom application error messages. To configure MongoDB to redact client information from its log file, edit the MongoDB configuration file (default location /etc/mongod.conf). Add the following option to the security section: security: redactClientLogData: true Restart the MongoDB server from the operating system: $ sudo systemctl restart mongod
- RMF Control
- SI-11
- Severity
- M
- CCI
- CCI-001314
- Version
- MD8X-00-005900
- Vuln IDs
-
- V-279368
- Rule IDs
-
- SV-279368r1179271_rule
Checks: C-83921r1179269_chk
A mongod or mongos running with "security.redactClientLogData:true" redacts any message accompanying a given log event before logging. This prevents the mongod or mongos from writing potentially sensitive data stored on the database to the diagnostic log. Metadata such as error or operation codes, line numbers, and source file names are still visible in the logs. To prevent too much information being displayed in the MongoDB logfiles, run the following command: > db.getSiblingDB("admin").runCommand({getCmdLineOpts: 1}).parsed.security.redactClientLogData If the command does not return true, this is a finding. The MongoDB command "getLog" will return data from the log file, which requires the "getLog" action type on the cluster resource. Ensure that application users are not authorized to execute this command. To validate this run the following command on the name of the application user to view actions its permitted to perform on the cluster resource: > db.runCommand({usersInfo: "<USER NAME>", showPrivileges: 1}).users[0].inheritedPrivileges.filter(privilege => privilege.resource.cluster) If "getLog" appears in the list of actions, this is a finding.
Fix: F-83826r1179270_fix
Edit the MongoDB configuration file (default location /etc/mongod.conf) and add the following parameter "redactClientLogData" in the security section of that file. Example: security: redactClientLogData: true Restart the MongoDB service from the OS. $ sudo systemctl restart mongod Identify and remove all unnecessary roles and privileges from application users.
- RMF Control
- AC-16
- Severity
- M
- CCI
- CCI-002262
- Version
- MD8X-00-006200
- Vuln IDs
-
- V-279371
- Rule IDs
-
- SV-279371r1179515_rule
Checks: C-83924r1179514_chk
If security labeling is not required, this is not a finding. If security labeling is required then there must be organizational or site-specific documentation on what the security labeling policy is and guidance on how and where to apply it. Review the organizational or site-specific security labeling documentation to understand how documents in specific MongoDB collection(s) must be marked. This marking process should be applied as data is entered into the database. Upon review of the security labeling documents, the following checks will be required. 1. Check if the role "SLTagViewer" exists. If this role does not exist, this is a finding. Note: The role name "SLTagViewer" is a user-defined (custom) role and is organizational or site-specific. The role name of "SLTagViewer" is used here as an example. Run the following commands: > use admin > db.getRole( "SLTagViewer", { showPrivileges: true } ) If the result returned is "null", this is a finding. 2. Check that data is appropriately marked in the specific MongoDB collection(s) that require security labeling. This check will be specific to the security labeling policy and guidance. Log in to MongoDB with a user that has a Security Label Tag Viewer role ("SLTagViewer", a role that has been created, which has access to read/view database/collections that require security labels). Review the data in the MongoDB collections requiring security labels to ensure the data is appropriately marked according to the security labeling documentation. For example, if documents in a MongoDB collection need to be marked as "TS", "S", "C", or "U" (or combination of) at the root level of the document and at each field level of the document, then the security labeling policy and guidance would indicate a document might look like the following and this would not be a finding ("sl" is the security label): { "_id": 1, "sl": [["TS"], ["S"]], "field1" : { "sl" : [ ["S"] ], "data" : "field1 value" }, "field2" : { "sl" : [ ["TS"] ], "data" : "field2 value" }, "field3" : { "sl" : [ ["S"] ], "data" : "field3 value" } } The following document would be a finding because at the field level, field2 is missing its security label of "sl": { "_id": 1, "sl": [["TS"], ["S"]], "field1" : { "sl" : [ ["S"] ], "data" : "field1 value" }, "field2" : { "data" : "field2 value" }, "field3" : { "sl" : [ ["S"] ], "data" : "field3 value" } } 3. Check that queries against the data in those collections use an appropriately constructed MongoDB $redact operation as part of the query pipeline to verify only the data appropriate for the query (that meets the security label requirements) is returned. Verify any query that targets the databases/collections that have security labeling have the appropriate MongoDB $redact operation applied; this is done through trusted middleware. This trusted middleware configuration is purpose-built (custom) code and integrations and is organizational or site-specific. Information on the basics of this can be found here: https://www.mongodb.com/docs/v8.0/reference/operator/aggregation/redact/ Any queries that target a MongoDB database/collection that has security labels, and that pass through the trusted middleware and do not have an appropriately constructed $redact operator that is part of the query aggregation pipeline, is a finding. The following is an example of the $redact operator for the example document: > db.security_collection.aggregate( [{ $redact: { $cond: [{ $anyElementTrue: { $map: { input: "$sl", as: "setNeeded", in: { $setIsSubset: ["$$setNeeded", ["S"]] } } } }, "$$DESCEND", "$$PRUNE"] } } ] )
Fix: F-83829r1179471_fix
To implement security labeling, ensure the following: 1. Organizational or site-specific documentation and guidance is available or developed. 2. Ensure security labels are applied to MongoDB collection(s) requiring them in accordance with the organization or site-specific documentation. 3. Create a Security Label Tag Viewer role ("SLTagViewer") with "find" privileges on the specific database and collection that requires security labeling. In the example below, there are three databases and collections in those databases where security labels are required: > use admin > db.createRole( { role: "SLTagViewer", privileges: [ { resource: { db: "db1", collection: "coll1" }, actions: [ "find" ] }, { resource: { db: "db1", collection: "coll2" }, actions: [ "find" ] }, { resource: { db: "db1", collection: "coll3" }, actions: [ "find" ] }, { resource: { db: "db2", collection: "coll1" }, actions: [ "find" ] }, { resource: { db: "db2", collection: "coll5" }, actions: [ "find" ] }, { resource: { db: "db2", collection: "coll9" }, actions: [ "find" ] }, { resource: { db: "db3", collection: "coll81" }, actions: [ "find" ] } ], roles: [ ] }, { w: "majority" , wtimeout: 5000 } ) 4. Ensure any query that targets the databases/collections that have security labeling have the appropriate MongoDB $redact operation applied. The $redact operator is applied through trusted middleware. This trusted middleware configuration is purpose-built (custom) code and integrations and is organizational or site specific. Information on the basics of how this is constructed can be found here: https://www.mongodb.com/docs/v8.0/reference/operator/aggregation/redact/
- RMF Control
- AC-3
- Severity
- M
- CCI
- CCI-002165
- Version
- MD8X-00-006500
- Vuln IDs
-
- V-279372
- Rule IDs
-
- SV-279372r1179475_rule
Checks: C-83925r1179473_chk
Review the MongoDB configuration file (default location /etc/mongod.conf). If the file does not contain the following entry, this is a finding: security: authorization: enabled
Fix: F-83830r1179474_fix
Enable authentication for MongoDB by following the instructions here: https://www.mongodb.com/docs/v8.0/tutorial/enable-authentication/ Create an administrative user in MongoDB: use admin db.createUser( { user: < username >, pwd: < passwordPrompt() >, // or cleartext password roles: [ { role: "userAdminAnyDatabase", db: "admin" }, { role: "readWriteAnyDatabase", db: "admin" } ] } ) Enable authorization by adding the following entry to the MongoDB configuration file: security: authorization: enabled Restart the MongoDB service from the OS. $ sudo systemctl restart mongod The "UserAdmin" user created above can use the "createUser" and "createRole" MongoDB commands to add the required users and roles per organizational or site-specific documentation. https://www.mongodb.com/docs/v8.0/reference/command/createUser/ https://www.mongodb.com/docs/v8.0/reference/command/createRole/
- RMF Control
- AC-6
- Severity
- M
- CCI
- CCI-002235
- Version
- MD8X-00-006600
- Vuln IDs
-
- V-279373
- Rule IDs
-
- SV-279373r1179516_rule
Checks: C-83926r1179284_chk
A organizational or site-specific document should exist and be reviewed to determine what built-in MongoDB roles and associated privileges may be considered authorized and what users are administrative users. For each database, run the following commands in MongoDB as an administrative user to determine what users and roles they are assigned: > use <database> > db.getUsers() For any nonadministrative user in a database, check if any roles are not compliant with the site-specific documentation for users. If any nonadministrative user in a database has a noncompliant role, this is a finding.
Fix: F-83831r1179476_fix
Ensure users are assigned only to authorized roles. To revoke a role from a user in a database, run the following commands: > use <database> > db.revokeRolesFromUser( "<username>", [ <roles> ], { <writeConcern> } ) Reference: https://www.mongodb.com/docs/v8.0/reference/method/db.revokeRolesFromUser/
- RMF Control
- AU-4
- Severity
- M
- CCI
- CCI-001849
- Version
- MD8X-00-006800
- Vuln IDs
-
- V-279375
- Rule IDs
-
- SV-279375r1179292_rule
Checks: C-83928r1179290_chk
Investigate whether there have been any incidents where the DBMS ran out of audit log space since the last time the space was allocated or other corrective measures were taken. If there have been, this is a finding.
Fix: F-83833r1179291_fix
To specify auditLog, or a centralized system log (which is recommended), configure these in the mongod.conf configuration file: auditLog: destination: syslog Allocate sufficient space to the storage volume hosting the file identified in the MongoDB configuration "auditLog.path" to support audit file peak demand.
- RMF Control
- AU-5
- Severity
- M
- CCI
- CCI-001855
- Version
- MD8X-00-006900
- Vuln IDs
-
- V-279376
- Rule IDs
-
- SV-279376r1179479_rule
Checks: C-83929r1179293_chk
Verify auditing is enabled in the mongodb configuration file (default location /etc/mongod.conf) and view the "auditlog.path" to identify the storage volume. Verify OS or other organization approved third-party monitoring software is installed. Verify the required alert in the monitoring software is set to send when storage volume holding the auditLog file utilization reaches 75 percent. If appropriate support staff are not notified immediately upon storage volume utilization reaching 75 percent, this is a finding.
Fix: F-83834r1179478_fix
View the mongodb configuration file (default location /etc/mongod.conf) and view the "auditlog.path" to identify the storage volume. Install OS or other organization-approved third-party monitoring software. Configure the required alert in the monitoring software to send an alert when storage volume holding the auditLog file utilization reaches 75 percent.
- RMF Control
- Severity
- M
- CCI
- CCI-003980
- Version
- MD8X-00-007300
- Vuln IDs
-
- V-279380
- Rule IDs
-
- SV-279380r1179481_rule
Checks: C-83933r1179305_chk
If MongoDB supports only software development, experimentation and/or developer-level testing (that is, excluding production systems, integration testing, stress testing, and user acceptance testing), this is not a finding. MongoDB can control nonadministrative users' ability to create, alter, or replace logic modules by defining specific roles and permissions. While MongoDB does not directly support stored procedures, functions, triggers, and views in the way relational databases do, similar functionalities can be implemented using various features. An organizational or site-specific document should exist and be reviewed to determine what built-in MongoDB roles and associated privileges may be considered authorized and what users are administrative users. For each database, run the following commands in MongoDB as an administrative user to determine what users and roles they are assigned: > use <database> > db.getUsers() For any nonadministrative user in a database, check if any roles are not compliant with the site-specific documentation for users. If any user in any database is found to have a role that is not allowed, this is a finding. MongoDB allows users to store JavaScript functions on the server. Javascript should be disabled for all users. Review the Mongodb configuration file (default location /etc/mongod.conf) and ensure the following is set to disable JavaScript: security: javascriptEnabled: false If this is not set in the MongoDB configuration file, this is a finding.
Fix: F-83838r1179480_fix
Revoke unapproved roles from nonadministrative users as per the site-specific document by executing db.revokeRolesFromUser for each user and database: > use <database> > db.revokeRolesFromUser( "<username>", [ <roles> ], { <writeConcern> } ) Reference: https://www.mongodb.com/docs/v8.0/reference/method/db.revokeRolesFromUser/ Edit the MongoDB configuration file (default location: /etc/mongod.conf) to include the following: security: javascriptEnabled: false
- RMF Control
- CM-5
- Severity
- M
- CCI
- CCI-001813
- Version
- MD8X-00-007400
- Vuln IDs
-
- V-279381
- Rule IDs
-
- SV-279381r1179310_rule
Checks: C-83934r1179308_chk
To verify that authentication and role-based access controls (RBAC) are configured correctly and restrictions are being enforced, create a test user and a custom role, and then confirm expected operations: Once authenticated as a database administrator, use db.createUser() to create an additional user. The following operation adds a user "myTester" to the test database who has read-only access on the test database: > use test > db.createUser( { user: "myTester", pwd: < password > , roles: [ { role: "read", db: "test" } ] } ) Log out and then back in as the "test" database user. Issue the following to attempt to write to the test database with a read-only privilege: > use test > db.testCollection.insertOne( { x: 1 } ) This operation will fail with an error similar to the following: "MongoServerError":"not authorized on test to execute command"{ "insert":"testCollection", "documents":[ { "x":1, "_id":"ObjectId("6500b96d1114d3a3ba7dda39")" } ], "ordered":true, "lsid":{ "id":"UUID("6cb3b9af-1ddc-446c-b0e0-bc9bf22807fa")" }, "$db":"test" } If the operation does not fail, this is a finding.
Fix: F-83839r1179309_fix
Locate a machine that can access the MongoDB Security Checklist here: https://www.mongodb.com/docs/v8.0/administration/security-checklist/ Review the MongoDB Security Checklist. Follow the procedures to enable MongoDB access control here: https://www.mongodb.com/docs/v8.0/tutorial/enable-authentication/#enable-access-control
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-001762
- Version
- MD8X-00-007600
- Vuln IDs
-
- V-279382
- Rule IDs
-
- SV-279382r1179313_rule
Checks: C-83935r1179311_chk
Review the network functions, ports, protocols, and services supported by the database management system (DBMS). If any protocol is prohibited by the PPSM guidance and is enabled, this is a finding.
Fix: F-83840r1179312_fix
Disable each prohibited network function, port, protocol, or service prohibited by the PPSM guidance. More information for MongoDB port management can be found at the following link: https://www.mongodb.com/docs/manual/reference/default-mongodb-port/
- RMF Control
- IA-11
- Severity
- M
- CCI
- CCI-002038
- Version
- MD8X-00-007700
- Vuln IDs
-
- V-279383
- Rule IDs
-
- SV-279383r1179483_rule
Checks: C-83936r1179482_chk
In MongoDB, a user can reauthenticate by explicitly logging out and then logging back in with the db.logout() and db.auth() commands, respectively. The steps to accomplish this would typically depend on the environment and interface, for example, shell, driver, or MongoDB Atlas. Log out of the current session using the db.logout() command. Run the following command from the database the user has authenticated from (example below uses "test" as the authentication database): > use test > db.logout() Example output: { ok: 1 } If the above output is not displayed upon logout, this is a finding. Log back in, using the db.auth() command: > use test > db.auth({ user: '<username>', pwd: '<password>' }) Example output: { ok: 1 } If the above output is not displayed upon login, this is a finding.
Fix: F-83841r1179315_fix
Enable authentication for MongoDB by following the instructions here: https://www.mongodb.com/docs/v8.0/tutorial/enable-authentication/ Create an administrative user in MongoDB: > use admin > db.createUser( { user: "UserAdmin", pwd: passwordPrompt(), // or cleartext password roles: [ { role: "userAdminAnyDatabase", db: "admin" }, { role: "readWriteAnyDatabase", db: "admin" } ] } ) Enable authorization by adding the following entry to the MongoDB configuration file: security: authorization: enabled Restart the MongoDB service from the OS. $ sudo systemctl restart mongod The "UserAdmin" user created above can use the "createUser" and "createRole" MongoDB commands to add the required users and roles per organizational or site-specific documentation. More information can be found here: https://www.mongodb.com/docs/v8.0/reference/command/createUser/ https://www.mongodb.com/docs/v8.0/reference/command/createRole/
- RMF Control
- SC-13
- Severity
- H
- CCI
- CCI-002450
- Version
- MD8X-00-007900
- Vuln IDs
-
- V-279385
- Rule IDs
-
- SV-279385r1179518_rule
Checks: C-83938r1179320_chk
If MongoDB is deployed in an unclassified environment, this is not a finding. Run the following command as an administrative user: > db.getSiblingDB("admin").runCommand({getCmdLineOpts: 1}).parsed.net.tls.FIPSMode If the output is not "true", this is a finding.
Fix: F-83843r1179321_fix
Enable FIPS mode for MongoDB Enterprise. Edit the MongoDB database configuration file (default location /etc/mongod.conf) to contain the following parameter setting: net: tls: FIPSMode: true Stop/start (restart) the mongod or mongos instance using this configuration and run the following command to verify the output is "true": > db.getSiblingDB("admin").runCommand({getCmdLineOpts: 1}).parsed.net.tls.FIPSMode The output of this command must be "true". Alternatively, run the following command to search the mongod logfile for "FIPS mode 140-2 activated": $ grep "FIPS 140-2 mode activated" /var/log/mongodb/mongod.log There should be a line similar to what is shown below: {"t":{"$date":"2025-02-26T15:21:09.174+00:00"},"s":"I", "c":"NETWORK", "id":23172, "ctx":"main","msg":"FIPS 140-2 mode activated"}
- RMF Control
- SC-23
- Severity
- M
- CCI
- CCI-002470
- Version
- MD8X-00-008000
- Vuln IDs
-
- V-279386
- Rule IDs
-
- SV-279386r1192925_rule
Checks: C-83939r1179519_chk
To run MongoDB in TLS mode, obtain a valid certificate singed by a single CA. Before starting the MongoDB database in TLS mode, verify the certificate used is issued by a valid DOD CA (openssl x509 -in <path_to_certificate_pem_file> -text | grep -i "issuer"). The certificates (pem files) used by MongoDB will be in the MongoDB configuration file net.tls section as shown below (default location /etc/mongod.conf). Each of these must be inspected, when present, to make sure they comply with a DOD Issuer for the certificate. net: tls: CAFile: <PEM file> certificateKeyFile: <PEM file> clusterFile: <PEM file> clusterCAFile: <PEM file> CRLFile: <PEM file> When using MongoDB's native encryption at rest, the following must also be inspected in the security.kmip section of the MongoDB configuration file: security: kmip: clientCertificateFile: <PEM file> serverCAFile: <PEM file> net.tls.CAFile The .pem file that contains the root certificate chain from the CA. Specify the file name of the .pem file using relative or absolute paths. net.tls.certificateKeyFile The .pem file that contains both the TLS certificate and key. net.tls.clusterFile The .pem file that contains the x.509 certificate-key file for membership authentication for the cluster or replica set. If there is any issuer present in the certificates being used that is not a DOD approved certificate authority, this is a finding. net.tls.clusterCAFile The .pem file that contains the root certificate chain from the CA used to validate the certificate presented by a client establishing a connection. Specify the file name of the .pem file using relative or absolute paths. net.tls.clusterCAFile requires that net.tls.CAFile is set. net.tls.CRLFile The .pem file that contains the Certificate Revocation List. Specify the file name of the .pem file using relative or absolute paths. security.kmip.clientCertificateFile Path to the .pem file used to authenticate MongoDB to the KMIP server. The specified .pem file must contain both the TLS/SSL certificate and key. security.kmip.serverCAFile Path to CA File. Used for validating secure client connection to KMIP server.
Fix: F-83844r1179324_fix
Remove any certificate referenced that was not issued by an approved DOD certificate authority. Contact the organization's certificate issuer and request a new certificate that is issued by a valid DOD certificate authorities.
- RMF Control
- SC-28
- Severity
- H
- CCI
- CCI-002475
- Version
- MD8X-00-008100
- Vuln IDs
-
- V-279387
- Rule IDs
-
- SV-279387r1179328_rule
Checks: C-83940r1179326_chk
Review the documentation or specification for the organization-defined information. If any data is PII, classified, or per the organization must be encrypted at rest, verify the method of encryption is documented. If no documented mechanism is being used to encrypt data-at-rest such as hardware encryption, volume encryption, filesystem encryption or the use of third-party products to enable encryption at rest, this is a finding. If the documented method to encrypt MongoDB data-at-rest is the native MongoDB encryption-at-rest, verify the MongoDB configuration file (default location /etc/mongod.conf) contains the following options: security: kmip: keyIdentifier: <string> rotateMasterKey: <boolean> serverName: <string> port: <string> clientCertificateFile: <string> clientCertificatePassword: <string> clientCertificateSelector: <string> serverCAFile: <string> connectRetries: <int> connectTimeoutMS: <int> activateKeys: <boolean> keyStatePollingSeconds: <int> If these above options are not configured in the MongoDB security.kmip section in the MongoDB configuration file, this is a finding.
Fix: F-83845r1179327_fix
Configure encryption-at-rest through hardware encryption, volume encryption, filesystem encryption, or third-party products if not using MongoDBs native encryption-at-rest. When using MongoDBs native encryption-at-rest, configure MongoDB to use the Encrypted Storage Engine and a KMIP appliance as documented here: https://www.mongodb.com/docs/v8.0/core/security-encryption-at-rest/ https://www.mongodb.com/docs/v8.0/tutorial/configure-encryption/
- RMF Control
- SC-8
- Severity
- M
- CCI
- CCI-002420
- Version
- MD8X-00-008400
- Vuln IDs
-
- V-279389
- Rule IDs
-
- SV-279389r1179334_rule
Checks: C-83942r1179332_chk
If the data owner does not have a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process, this is not a finding. If such a requirement is present, inspect the MongoDB configuration file (default location: /etc/mongod.conf) for the following entries: net: tls: mode: requireTLS certificateKeyFile: <PEM File> CAFile: <PEM File> allowInvalidCertificates: false allowConnectionsWithoutCertificates: false FIPSMode: true If net.tls.mode is not set to "requireTLS", this is a finding.
Fix: F-83847r1179333_fix
Stop the MongoDB instance if it is running. Obtain a certificate from a valid DOD certificate authority to be used for encrypted data transmission. Modify the MongoDB configuration file to include the following TLS configuration options: net: tls: mode: requireTLS certificateKeyFile: <PEM File> CAFile: <PEM File> allowInvalidCertificates: false allowConnectionsWithoutCertificates: false FIPSMode: true Set "net.tls.mode" to the "requireTLS". <PEM File> is the fullpathnames to the certificates used for the option. Start/stop (restart) all mongod or mongos instances using the MongoDB configuration file (default location: /etc/mongod.conf).
- RMF Control
- SI-10
- Severity
- M
- CCI
- CCI-002754
- Version
- MD8X-00-008600
- Vuln IDs
-
- V-279390
- Rule IDs
-
- SV-279390r1179486_rule
Checks: C-83943r1179335_chk
When an application requires specific fields to be validated at the collection level, MongoDB's schema validation ensures that there are no unintended schema changes or improper data types for those fields. Refer to the application's guidelines and documentation. If there is no requirement for collection-level schema validation for specific fields, this is not a finding. If the application's guidelines and documentation require collection-level schema validation for a specific collection on specific fields, follow these steps: 1. As a user with the "dbAdminAnyDatabase" role, run the following commands for each database that contains collections used by the application: use <database> db.getCollectionInfos() This returns an array of documents containing information about all collections within "<database>". 2. For each specific collection (identified by the "name:" field in the output) used by the application that requires a schema validation, check the "options" sub-document for that collection. 3. If the "options" sub-document for that specific collection does not contain a "validator" sub-document, this is a finding. Below is an example output of a collection named "testCollectionWithValidator" (indicated by "name" field) with a "validator" in the "options" sub-document: [ { name: 'testCollectionWithValidator', type: 'collection', options: { validator: { '$jsonSchema': { bsonType: 'object', required: [ 'username', 'password' ], properties: { username: { bsonType: 'string', minLength: 3, description: 'must be a string and is required with a minimum length of 3 characters' }, password: { bsonType: 'string', minLength: 8, description: 'must be a string and is required with a minimum length of 8 characters' } } } }, validationLevel: 'strict', validationAction: 'error' }, info: { readOnly: false, uuid: UUID('cf0629c2-7355-4bf8-a44b-54b9f31e4845') }, idIndex: { v: 2, key: { _id: 1 }, name: '_id_' } } ] If the "options" sub-document contains a "validator", verify it against the application guidelines and documentation. Verify the validator checks for the presence of all fields specified in the application guidelines and documentation needing a collection level validation and confirm that the correct data types and/or ranges are being validated. If any fields specified in the application guidelines or documentation are missing from the validator, or if present and the fields do not have the correct data types and/or ranges, this is a finding.
Fix: F-83848r1179485_fix
Document validation can be added at the time of creation of a new collection. Also, existing collections can be modified with document validation rules. Use the "validator" option to create or update a collection with the desired validation rules. Refer to Schema Validation documentation for details: https://www.mongodb.com/docs/v8.0/core/schema-validation/
- RMF Control
- SI-2
- Severity
- M
- CCI
- CCI-002617
- Version
- MD8X-00-008700
- Vuln IDs
-
- V-279391
- Rule IDs
-
- SV-279391r1179488_rule
Checks: C-83944r1179487_chk
Run the following command and observe the output. This command will determine if MongoDB has been installed with a package manager (RedHat) and display what version is currently installed: > rpm -q mongodb-enterprise-server.x86_64 mongodb-enterprise-server-8.0.8-1.el9.x86_64 The output of the command above indicates that MongoDB Enterprise Server has been installed with a package manager. In the preceding output is an example showing that MongoDB Enterprise Server Version 8.0.8 is installed. The specific version will be dependent on the actual version installed. Upgrading MongoDB with the same package manager used for installation will overwrite or remove files as part of the upgrade process. If MongoDB was installed with a Package Manager (YUM/RPM for RedHat) then this is not a finding. Run the following command and observe the output: > rpm -q mongodb-enterprise-server.x86_64 package mongodb-enterprise-server.x86_64 is not installed The output of the command above indicates that MongoDB has not been installed via a package manager or may not have been installed at all. If MongoDB has not been installed with a Package Manger (YUM/RPM for RedHat), this is a finding.
Fix: F-83849r1179339_fix
It is recommended to use the official installation packages provided by MongoDB. In the event the software was installed manually and permissions need to be restricted, consider a clean reinstallation. Review this organizational or site-specific document to determine how and where MongoDB is to be installed on the system. Using this documentation, verify that MongoDB has been installed on the system prior to upgrading. To verify the version of MongoDB Enterprise Server, run the following command in the directory where the MongoDB executable binary has been placed according to the organizational or site-specific documentation. > cd <mongod binary directory> > ./mongod --version The output will show the version and architecture of the MongoDB Server binary similar to the following: db version v8.0.8 Build Info: { "version": "8.0.8", "gitVersion": "7f52660c14217ed2c8d3240f823a2291a4fe6abd", "openSSLVersion": "OpenSSL 3.2.2 4 Jun 2024", "modules": [ "enterprise" ], "allocator": "tcmalloc-google", "environment": { "distmod": "rhel93", "distarch": "x86_64", "target_arch": "x86_64" } } Verify the version desired (what the upgraded version should be) matches what is shown in the output. If the version is not what is expected, then remove the mongod binary from the system to prevent it from being used and consult the organizational or site-specific documents for further guidance. Run the following commands as an operating system administrator to remove the MongoDB Enterprise Server binary from the system: > cd <mongod binary directory> > rm ./mongod
- RMF Control
- SI-2
- Severity
- M
- CCI
- CCI-002605
- Version
- MD8X-00-008800
- Vuln IDs
-
- V-279392
- Rule IDs
-
- SV-279392r1179521_rule
Checks: C-83945r1179341_chk
Review the organizational or site-specific software update policy and verify MongoDB has been updated consistent with the time frame specified by that policy. The current patch release versions of MongoDB 8.0.x can be found here: https://www.mongodb.com/docs/manual/release-notes/8.0/. This link will show the patch release versions with the date of release for all of MongoDB 8.0.x. If MongoDB has not been updated to the necessary major and minor release in accordance with the policy, this is a finding.
Fix: F-83850r1179342_fix
Institute and adhere to the policies and procedures to ensure MongoDB is updated to remain consistent with the organizational or site-specific software update policy and time frame. Update MongoDB to the necessary major and minor release in accordance with the organizational or site-specific policy.
- RMF Control
- SA-22
- Severity
- H
- CCI
- CCI-003376
- Version
- MD8X-00-008900
- Vuln IDs
-
- V-279393
- Rule IDs
-
- SV-279393r1179522_rule
Checks: C-83946r1179344_chk
Review the current version of MongoDB running on the system. Run the following command from the OS command line and review the "db version" listed in the output: $ mongod --version | grep "db version" Compare the version from the output to the supported version matrix here: https://www.mongodb.com/support-policy/lifecycles If the version output in the above command has reached its "End of Life Date" shown in the matrix, this is a finding.
Fix: F-83851r1179345_fix
Ensure a license agreement is still in effect and, if so, upgrade to a supported version of MongoDB. Each major release of MongoDB has upgrade instructions. Follow the upgrade path/procedures for the version and configuration (standalone, replica set, sharded) of MongoDB accordingly. If the license agreement with MongoDB has lapsed, contact MongoDB to license the use of a supported version.
- RMF Control
- AU-4
- Severity
- M
- CCI
- CCI-001851
- Version
- MD8X-00-012100
- Vuln IDs
-
- V-279394
- Rule IDs
-
- SV-279394r1179490_rule
Checks: C-83947r1179347_chk
MongoDB relies on the underlying operating system to allocate storage capacity for audit logs and as such, does not enforce arbitrary file size limits on audit logs. System administrators should confirm that the recommended centralized system logging has been enabled (e.g., syslog on Linux systems) in the /etc/mongod.conf configuration file. For example, on a Linux-based system using syslog, which is mirrored to an off-server centralized location, confirm that the MongoDB configuration file (default location: /etc/mongod.conf) contains a properly configured auditLog such as follows: auditLog: destination: syslog If the auditLog entry is missing, or the destination does not reflect the intended application location, this is a finding. Investigate whether there have been any incidents where MongoDB ran out of audit log space since the last time the space was allocated or other corrective measures were taken.
Fix: F-83852r1179489_fix
To specify auditLog, or a centralized system log (recommended), configure these in the mongod.conf configuration file: auditLog: destination: syslog Refer to documentation for additional configuration: https://www.mongodb.com/docs/v8.0/core/auditing/ When deploying a Log Forwarding Tool, use a monitor for the audit log file and push records to a centralized log management system (e.g., Elasticsearch, Splunk, or a custom solution). Allocate sufficient space to the storage volume hosting the file identified in the MongoDB configuration "auditLog.path" to support audit file peak demand.
- RMF Control
- CM-6
- Severity
- M
- CCI
- CCI-000366
- Version
- MD8X-00-012200
- Vuln IDs
-
- V-279395
- Rule IDs
-
- SV-279395r1179492_rule
Checks: C-83948r1179350_chk
Review the MongoDB documentation and configuration to determine if the DBMS is configured in accordance with DOD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, DTMs, and IAVMs. If MongoDB is not configured in accordance with security configuration settings, this is a finding.
Fix: F-83853r1179491_fix
Configure the DBMS in accordance with DOD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, DTMs, and IAVMs. It is recommended that MongoDB Enterprise be installed and upgraded though the use of a package manager (YUM/RPM RedHat) where it meets the organizational or site-specific policy. Reference: https://www.mongodb.com/docs/v8.0/tutorial/install-mongodb-enterprise-on-red-hat/
- RMF Control
- Severity
- M
- CCI
- CCI-003992
- Version
- MD8X-00-012700
- Vuln IDs
-
- V-279398
- Rule IDs
-
- SV-279398r1179494_rule
Checks: C-83951r1179411_chk
1. Identify that the MongoDB repository is installed and enabled by running the following command: $ yum repolist enabled | grep "mongodb-enterprise-8.0". 2. Review the contents of the repository file (/etc/yum.repos.d/mongodb-enterprise-8.0.repo) and compare them to the standard configuration below: [mongodb-enterprise-8.0] name=MongoDB Enterprise Repository baseurl=https://repo.mongodb.com/yum/redhat/9/mongodb-enterprise/8.0/$basearch/ gpgcheck=1 enabled=1 gpgkey=https://pgp.mongodb.com/server-8.0.asc 3. Examine the installed MongoDB components and their versions by running the following command: $ yum list installed mongodb-* 4. The output will resemble the following, but with potentially different versions: Installed Packages mongodb-database-tools.x86_64 100.12.2-1 @mongodb-enterprise-8.0 mongodb-enterprise.x86_64 8.0.12-1.el9 @mongodb-enterprise-8.0 mongodb-enterprise-cryptd.x86_64 8.0.12-1.el9 @mongodb-enterprise-8.0 mongodb-enterprise-database.x86_64 8.0.12-1.el9 @mongodb-enterprise-8.0 mongodb-enterprise-database-tools-extra.x86_64 8.0.12-1.el9 @mongodb-enterprise-8.0 mongodb-enterprise-mongos.x86_64 8.0.12-1.el9 @mongodb-enterprise-8.0 mongodb-enterprise-server.x86_64 8.0.12-1.el9 @mongodb-enterprise-8.0 mongodb-enterprise-tools.x86_64 8.0.12-1.el9 @mongodb-enterprise-8.0 mongodb-mongosh.x86_64 2.5.6-1.el8 @mongodb-enterprise-8.0 5. Check for available updates for the installed MongoDB components by running the following command: $ sudo yum check-update --repo mongodb-enterprise-8.0 The output will list any components that need to be updated. If the MongoDB repository is not enabled, its contents do not match the standard configuration, or if any components are not installed or are not the most current version available, this is a finding.
Fix: F-83856r1179493_fix
Ensure the MongoDB repository is configured according to the official documentation. Install any missing or outdated components by running the command: $ sudo yum update --repo mongodb-enterprise-8.0 Restart the MongoDB service: $ sudo systemctl restart mongod The YUM method is the preferred method because it provides automatic dependency management, built-in rollback support, and simplified security updates. These features reduce the risk of misconfiguration and ensure a more stable and secure environment that is easier to maintain and keep compliant. For additional details, refer to the MongoDB documentation: https://www.mongodb.com/docs/v8.0/tutorial/install-mongodb-enterprise-on-red-hat/
- RMF Control
- Severity
- M
- CCI
- CCI-004045
- Version
- MD8X-00-012800
- Vuln IDs
-
- V-279399
- Rule IDs
-
- SV-279399r1179524_rule
Checks: C-83952r1179362_chk
Check the MongoDB configuration file (default location /etc/mongod.conf) for a section named "security". If this section does not contain the subkey of "authorization" with a value of "enabled" as shown below, this is a finding. security: authorization: enabled
Fix: F-83857r1179523_fix
Enable authorization for MongoDB Enterprise. Read the directions in the MongoDB documentation here: https://www.mongodb.com/docs/v8.0/tutorial/configure-scram-client-authentication/ Create the user administrator. Edit the MongoDB database configuration file (default location /etc/mongod.conf) to contain the following setting in the security section: security: authorization: enabled Stop/start (restart) the mongod or mongos instance using this configuration. Log on to MongoDB as an authorized user created by the user administrator and run the following command to verify the output is "true": db.getSiblingDB("admin").runCommand({getCmdLineOpts: 1}).parsed.security.authorization The output of this command must be "true".
- RMF Control
- Severity
- M
- CCI
- CCI-004068
- Version
- MD8X-00-013800
- Vuln IDs
-
- V-279409
- Rule IDs
-
- SV-279409r1179526_rule
Checks: C-83962r1179525_chk
Check the MongoDB configuration file (default location /etc/mongod.conf) for a key named "setParameter". Examples shown below: setParameter: ocspEnabled: true If this key "setParameter" and the subkey "ocspEnabled: true" are not found, this is a finding.
Fix: F-83867r1179393_fix
Edit the MongoDB configuration file (default location /etc/mongod.conf) and add "setParameter" and its subkey "ocspEnabled" as shown below. setParameter: ocspEnabled: true Refer to: https://www.mongodb.com/docs/v8.0/core/security-transport-encryption/#ocsp--online-certificate-status-protocol-
- RMF Control
- Severity
- M
- CCI
- CCI-004909
- Version
- MD8X-00-014000
- Vuln IDs
-
- V-279411
- Rule IDs
-
- SV-279411r1179400_rule
Checks: C-83964r1179398_chk
Check the MongoDB configuration file (default location /etc/mongod.conf) for a key named "net.tls.CAFile". Example shown below: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem ocsp: enabled: true responderURL: <your organization's OCSP responder URL> If this key is not found, this is a finding.
Fix: F-83869r1179399_fix
Edit the MongoDB configuration file (default location /etc/mongod.conf) and add a key named "net.tls.CAFile" to configure the certificate trust. Example shown below: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem ocsp: enabled: true responderURL: <your organization's OCSP responder URL>
- RMF Control
- Severity
- M
- CCI
- CCI-004910
- Version
- MD8X-00-014100
- Vuln IDs
-
- V-279412
- Rule IDs
-
- SV-279412r1179403_rule
Checks: C-83965r1179401_chk
Check the MongoDB configuration file (default location /etc/mongod.conf) for a key named "net.tls.CAFile". Example shown below: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem ocsp: enabled: true responderURL: <your organization's OCSP responder URL> Run the following command on the file indicated by this key: stat /etc/ssl/caToValidateClientCertificates.pem If the output does not show file permissions of "-rw-------", this is a finding.
Fix: F-83870r1179402_fix
Check the MongoDB configuration file (default location /etc/mongod.conf) for a key named "net.tls.CAFile". Example shown below: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem ocsp: enabled: true responderURL: <your organization's OCSP responder URL> Run the following commands on the file indicated by this key: chmod 600 /etc/ssl/caToValidateClientCertificates.pem
- RMF Control
- AC-12
- Severity
- L
- CCI
- CCI-002361
- Version
- MD8X-00-006050
- Vuln IDs
-
- V-281700
- Rule IDs
-
- SV-281700r1179499_rule
Checks: C-86261r1179497_chk
Review system documentation to obtain the organization's definition of circumstances requiring automatic session termination. If the documentation explicitly states that such termination is not required or is prohibited, this is not a finding. Ensure a script is in place and scheduled that does the following (see fix content for example commands): 1. Lists all user sessions. 2. From the output, determines which user-initiated database sessions must be terminated. 3. Terminates the identified sessions by user. If a script does not exist or is not scheduled to run at least daily, this is a finding.
Fix: F-86166r1179498_fix
Determine the situations when a user-initiated database session must be terminated. Note: The user running the commands shown below must have privileges with listSessions, killAnySession and impersonate action on the cluster. In the MongoDB shell, as an authenticated user, run the following command to list all user sessions: > use config > db.system.sessions.aggregate( [ { $listSessions: { allUsers: true } } Reference: https://docs.mongodb.com/v8.0/reference/operator/aggregation/listSessions/ Example output: { "_id" : { "id" : UUID("b3b50641-54c6-4d6d-a96e-a2239fadce3c"), "uid" : BinData(0,"Y5mrDaxi8gv8RmdTsQ+1j7fmkr7JUsabhNmXAheU0fg=") }, "lastUse" : ISODate("2021-09-23T23:34:43.951Z"), "user" : { "name" : "jsmith@admin" } } From the output, identify the names of users whose sessions should be terminated. Using the user for each session to be terminated, run the following command (still in MongoDB shell): > db.runCommand( { killAllSessionsByPattern: [ { users: [ { user: <user>, db: <dbname> }, ... ] }] } ) Example to terminate user "jsmith@admin" sessions from example output: > db.runCommand( { killAllSessionsByPattern: [ { users: [ { user: "jsmith", db: "admin" } ] }]} ) To terminate all user sessions running on the database, run the following command (still in MongoDB shell): > db.runCommand( { killAllSessionsByPattern: [ ] } ) Reference: https://docs.mongodb.com/v8.0/reference/command/killAllSessionsByPattern/
- RMF Control
- CM-7
- Severity
- M
- CCI
- CCI-000382
- Version
- MD8X-00-003350
- Vuln IDs
-
- V-282943
- Rule IDs
-
- SV-282943r1179530_rule
Checks: C-87504r1179528_chk
To verify administrative access is logically separated and restricted to authorized management networks: 1. Review the organization-defined administrative roles. These administrative roles include, but are not limited to: root, clusterAdmin, dbAdminAnyDatabase, userAdminAnyDatabase, dbAdmin, userAdmin, and dbOwner. 2. Review all users within the admin database to identify those assigned any of the administrative roles defined above. 3. For each identified administrative user, check for the presence of the authenticationRestrictions field. Verify that a clientSource is defined to restrict access to authorized management networks. Example script: // Define admin roles const adminRoles = new Set(["root", "clusterAdmin", "dbAdminAnyDatabase", "userAdminAnyDatabase", "dbAdmin", "userAdmin", "dbOwner", "<your_custom_admin_role>"]); // Check all users under 'admin' and filter for admin roles const admins = db.getSiblingDB("admin").system.users.find().toArray() .filter(u => u.roles.some(r => adminRoles.has(r.role))) .map(u => { const restr = u.authenticationRestrictions || []; const clientIPs = restr.flatMap(r => r.clientSource || []); const serverIPs = restr.flatMap(r => r.serverAddress || []); return { "User": u.user, "DB": u.db, "Admin Roles": u.roles.filter(r => adminRoles.has(r.role)).map(r => r.role).join(", "), "Client IPs": clientIPs.length ? clientIPs.join(", ") : "ANY (Unrestricted)", "Server Address": serverIPs.length ? serverIPs.join(", ") : "ANY (Unrestricted)" }; }); console.table(admins); If an administrative user does not have an authenticationRestrictions field defined, or if the clientSource is not restricted to a valid, organization-defined management network, this is a finding. If the local policy requires interface-specific isolation and the Server Address is not defined or is not restricted to the server's management interface IP, this is a finding. In the absence of approved documentation, assume localhost (127.0.0.1) is the only approved address. Example output: (note that user0 is compliant while user1 is not) (index) User DB Admin Roles Client IPs Server Address 0 'user0' 'admin' 'root' '127.0.0.1' '127.0.0.1' 1 'user1' 'admin' 'root' 'ANY (Unrestricted)' 'ANY (Unrestricted)'
Fix: F-87409r1179529_fix
For all administrative users that do not have network restrictions configured, use the following command: use admin db.updateUser( "<username>", { authenticationRestrictions: [ { clientSource: [ "<ip_or_cidr>", serverAddress: ["<ip_or_cidr>"] } ] }) Run the following command to set to local host: use admin db.updateUser("<username>", { authenticationRestrictions: [ { clientSource: ["127.0.0.1"], serverAddress: ["127.0.0.1"] } ] }) More information can be found here: https://www.mongodb.com/docs/manual/reference/command/createUser/#authentication-restrictions