MongoDB Enterprise Advanced 4.x Security Technical Implementation Guide

  • Version/Release: V1R3
  • Published: 2023-12-18
  • Released: 2024-01-24
  • Expand All:
  • Severity:
  • Sort:
Compare

Select any two versions of this STIG to compare the individual requirements

View

Select any old version/release of this STIG to view the previous requirements

This Security Technical Implementation Guide is published as a tool to improve the security of Department of Defense (DOD) information systems. The requirements are derived from the National Institute of Standards and Technology (NIST) 800-53 and related documents. Comments or proposed revisions to this document should be sent via email to the following address: disa.stig_spt@mail.mil.
b
MongoDB must provide audit record generation for DoD-defined auditable events within all DBMS/database components.
AU-3 - Medium - CCI-000130 - V-252134 - SV-252134r879559_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-000130
Version
MD4X-00-000100
Vuln IDs
  • V-252134
Rule IDs
  • SV-252134r879559_rule
MongoDB must provide audit record generation capability for DoD-defined auditable events within all DBMS/database components. Satisfies: SRG-APP-000089-DB-000064, SRG-APP-000080-DB-000063, SRG-APP-000090-DB-000065, SRG-APP-000091-DB-000066, SRG-APP-000091-DB-000325, SRG-APP-000092-DB-000208, SRG-APP-000095-DB-000039, SRG-APP-000096-DB-000040, SRG-APP-000097-DB-000041, SRG-APP-000098-DB-000042, SRG-APP-000099-DB-000043, SRG-APP-000100-DB-000201, SRG-APP-000101-DB-000044, SRG-APP-000109-DB-000049, SRG-APP-000356-DB-000315, SRG-APP-000360-DB-000320, SRG-APP-000381-DB-000361, SRG-APP-000492-DB-000332, SRG-APP-000492-DB-000333, SRG-APP-000494-DB-000344, SRG-APP-000494-DB-000345, SRG-APP-000495-DB-000326, SRG-APP-000495-DB-000327, SRG-APP-000495-DB-000328, SRG-APP-000495-DB-000329, SRG-APP-000496-DB-000334, SRG-APP-000496-DB-000335, SRG-APP-000498-DB-000346, SRG-APP-000498-DB-000347, SRG-APP-000499-DB-000330, SRG-APP-000499-DB-000331, SRG-APP-000501-DB-000336, SRG-APP-000501-DB-000337, SRG-APP-000502-DB-000348, SRG-APP-000502-DB-000349, SRG-APP-000503-DB-000350, SRG-APP-000503-DB-000351, SRG-APP-000504-DB-000354, SRG-APP-000504-DB-000355, SRG-APP-000505-DB-000352, SRG-APP-000506-DB-000353, SRG-APP-000507-DB-000356, SRG-APP-000507-DB-000357, SRG-APP-000508-DB-000358, SRG-APP-000515-DB-000318
Checks: C-55590r855499_chk

Check the MongoDB configuration file (default location: /etc/mongod.conf) for appropriate audit configuration keys. Examples shown below: auditLog: destination: file format: BSON path: /var/log/mongodb/audit/auditLog.bson -OR- auditLog: destination: syslog If an auditLog key is not present, this is a finding. If the MongoDB configuration file does not contain a setParameter option with auditAuthorizationSuccess: true, this is a finding. Example: setParameter: auditAuthorizationSuccess: true If the auditLog key is present and contains a filter subkey without an associated filter, 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, then the filter being applied will need to be modified to comply. Example filter shown below only audits createCollection and dropCollection: auditLog: destination: file format: BSON path: /var/log/mongodb/audit/auditLog.bson filter: '{ atype: { $in: [ "createCollection", "dropCollection" ] } }'

Fix: F-55540r813783_fix

If the auditLog setting was not present in the %MongoDB configuration file% (default location: /etc/mongod.conf) edit this file and add a configured auditLog setting: auditLog: destination: file format: BSON path: /var/log/mongodb/audit/auditLog.bson Note: The "/var/log/mongodb/audit" directory will need to be created/present or the database will not start. Alternately, the audit logs can be written to syslog with the following setting: auditLog: destination: syslog This setting will record the following operations: schema (DDL), replica set and sharded cluster and authentication and authorization. To capture all operations in the audit, enable the audit system to log authorization successes by adding the following line to the /etc/mongod.conf file: setParameter: auditAuthorizationSuccess: true Stop/start (restart) the mongod or mongos instance using this configuration. 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 or remove the filter parameter to enable auditing all events. Documentation on configuring filters can be found here: https://docs.mongodb.com/v4.4/tutorial/configure-audit-filters/

b
The audit information produced by MongoDB must be protected from unauthorized access.
AU-9 - Medium - CCI-000162 - V-252135 - SV-252135r879576_rule
RMF Control
AU-9
Severity
Medium
CCI
CCI-000162
Version
MD4X-00-000200
Vuln IDs
  • V-252135
Rule IDs
  • SV-252135r879576_rule
If audit data were to become compromised, then competent forensic analysis and discovery of the true source of potentially malicious system activity is difficult, if not impossible, to achieve. In addition, access to audit records provides information an attacker could potentially use to his or her advantage. To ensure the veracity of audit data, the information system and/or the application must protect audit information from any and all unauthorized access. This includes read, write, copy, etc. This requirement can be achieved through multiple methods which will depend upon system architecture and design. Some commonly employed methods include ensuring log files enjoy the proper file system permissions utilizing file system protections and limiting log data location. Additionally, applications with user interfaces to audit records should not allow for the unfettered manipulation of or access to those records via the application. If the application provides access to the audit data, the application becomes accountable for ensuring that audit information is protected from unauthorized access. Audit information includes all information (e.g., audit records, audit settings, and audit reports) needed to successfully audit information system activity. Satisfies: SRG-APP-000118-DB-000059, SRG-APP-000119-DB-000060, SRG-APP-000120-DB-000061
Checks: C-55591r813785_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: /var/log/mongodb/audit/auditLog.bson -OR- auditLog: destination: syslog 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 700, 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 parameters 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 output: File: '/var/log/mongodb/audit' Size: 48 Blocks: 0 IO Block: 4096 directory Device: 808h/2056d Inode: 245178 Links: 2 Access: (0700/drwx------) 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-55541r813786_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. If the key name auditLog.destination is set to either syslog or console, then this requirement is not applicable as there is no physical directory that MongoDB can secure. Site security requirements and operating system security requirements will need to be reviewed to ensure appropriate settings for syslog and console destinations. To correct finding where a physical auditLog directory exists (where auditLog.destination is set to file), run these commands: chown mongod %MongoDB auditLog directory% chgrp mongod %MongoDB auditLog directory% chmod 700 %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.

b
MongoDB must protect its audit features from unauthorized access.
AU-9 - Medium - CCI-001493 - V-252136 - SV-252136r879579_rule
RMF Control
AU-9
Severity
Medium
CCI
CCI-001493
Version
MD4X-00-000300
Vuln IDs
  • V-252136
Rule IDs
  • SV-252136r879579_rule
Protecting audit data also includes identifying and protecting the tools used to view and manipulate log data. Depending upon the log format and application, system and application log tools may provide the only means to manipulate and manage application and system log data. It is, therefore, imperative that access to audit tools be controlled and protected from unauthorized access. Applications providing tools to interface with audit data will leverage user permissions and roles identifying the user accessing the tools and the corresponding rights the user enjoys in order make access decisions regarding the access to audit tools. Audit tools include, but are not limited to, OS-provided audit tools, vendor-provided audit tools, and open source audit tools needed to successfully view and manipulate audit information system activity and records. If an attacker were to gain access to audit tools, they could analyze audit logs for system weaknesses or weaknesses in the auditing itself. An attacker could also manipulate logs to hide evidence of malicious activity. Satisfies: SRG-APP-000121-DB-000202, SRG-APP-000122-DB-000203, SRG-APP-000123-DB-000204
Checks: C-55592r813788_chk

To ensure audit configurations are protected from unauthorized modification, 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) (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 660, this is a finding. Note that the audit destination cannot be modified at runtime.

Fix: F-55542r813789_fix

Run these commands: chown mongod %MongoDB configuration file% chgrp mongod %MongoDB configuration file% chmod 660 %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 660 /etc/mongod.conf The output of the command: stat /etc/mongod.conf should look similar to the following for a correctly owned and permissioned %MongoDB configuration file% (default /etc/mongod.conf): stat /etc/mongod.conf File:/etc/mongod.conf Size: 1034 Blocks: 8 IO Block: 4096 regular file Device: 802h/2050d Inode: 16340 Links: 1 Access: (0660/-rw-rw----) Uid: ( 997/ mongod) Gid: ( 996/ mongod) Context: system_u:object_r:etc_t:s0 Access: 2020-03-16 14:15:17.777000000 -0400 Modify: 2020-03-16 12:50:45.567000000 -0400 Change: 2020-03-16 14:27:32.451000000 -0400 Birth: -

b
Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled.
CM-7 - Medium - CCI-000381 - V-252137 - SV-252137r879587_rule
RMF Control
CM-7
Severity
Medium
CCI
CCI-000381
Version
MD4X-00-000400
Vuln IDs
  • V-252137
Rule IDs
  • SV-252137r879587_rule
Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). It is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives. DBMSs must adhere to the principles of least functionality by providing only essential capabilities. Unused, unnecessary DBMS components increase the attack vector for MongoDB by introducing additional targets for attack. By minimizing the services and applications installed on the system, the number of potential vulnerabilities is reduced. Components of the system that are unused and cannot be uninstalled must be disabled. The techniques available for disabling components will vary by DBMS product, OS, and the nature of the component and may include DBMS configuration settings, OS service settings, OS file access security, and DBMS user/role permissions.
Checks: C-55593r813791_chk

In the MongoDB database configuration file (default location: /etc/mongod.conf), review for the following option: net: http: enabled: true JSONPEnabled: true RESTInterfaceEnabled: true If the configuration file contains any combination of http settings under the net: option, this is a finding.

Fix: F-55543r813792_fix

MongoDB 3.6 removed the following deprecated HTTP interface and REST API to MongoDB. net.http.enabled net.http.JSONPEnabled net.http.port net.http.RESTInterfaceEnabled In the MongoDB database configuration file (default location: /etc/mongod.conf), remove the entire http option (and any sub-options) under the net: settings from the configuration file.

b
Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled.
CM-7 - Medium - CCI-000382 - V-252138 - SV-252138r879588_rule
RMF Control
CM-7
Severity
Medium
CCI
CCI-000382
Version
MD4X-00-000500
Vuln IDs
  • V-252138
Rule IDs
  • SV-252138r879588_rule
Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). It is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives. DBMSs must adhere to the principles of least functionality by providing only essential capabilities. Unused, unnecessary DBMS components increase the attack vector for MongoDB by introducing additional targets for attack. By minimizing the services and applications installed on the system, the number of potential vulnerabilities is reduced. Components of the system that are unused and cannot be uninstalled must be disabled. The techniques available for disabling components will vary by DBMS product, OS, and the nature of the component and may include DBMS configuration settings, OS service settings, OS file access security, and DBMS user/role permissions.
Checks: C-55594r816977_chk

Inspect the MongoDB database configuration file (default location: /etc/mongod.conf) for any net.http options similar in construct to the following: net: http: option 1: value option 2: value Example: It may appear similar to the following (having one or more options): net: http: enabled: true port: port number JSONPEnabled: true RESTInterfaceEnabled: true If the configuration file contains any "http:" options under "net:", this is a finding.

Fix: F-55544r813795_fix

MongoDB 3.6 removed the following deprecated HTTP interface and REST API to MongoDB and should not be used. net.http.enabled net.http.JSONPEnabled net.http.port net.http.RESTInterfaceEnabled In the MongoDB database configuration file (default location: /etc/mongod.conf), remove all http: options underneath net: from the configuration file.

c
If passwords are used for authentication, MongoDB must transmit only encrypted representations of passwords.
IA-5 - High - CCI-000197 - V-252139 - SV-252139r879609_rule
RMF Control
IA-5
Severity
High
CCI
CCI-000197
Version
MD4X-00-000600
Vuln IDs
  • V-252139
Rule IDs
  • SV-252139r879609_rule
The DoD standard for authentication is DoD-approved PKI certificates. Authentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate, and requires AO approval. In such cases, passwords need to be protected at all times, and encryption is the standard method for protecting passwords during transmission. DBMS passwords sent in clear text format across the network are vulnerable to discovery by unauthorized users. Disclosure of passwords may easily lead to unauthorized access to the database. Satisfies: SRG-APP-000172-DB-000075, SRG-APP-000175-DB-000067
Checks: C-55595r813797_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/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem 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-55545r863316_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/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem allowInvalidCertificates: false allowConnectionsWithoutCertificates: false Stop/start (restart) the mongod or mongos instance using this configuration. More information for configuring TLS/SSL for MongoDB can be found here: https://docs.mongodb.com/v4.4/tutorial/configure-ssl/

b
MongoDB must uniquely identify and authenticate non-organizational users (or processes acting on behalf of non-organizational users).
SC-2 - Medium - CCI-001082 - V-252140 - SV-252140r879631_rule
RMF Control
SC-2
Severity
Medium
CCI
CCI-001082
Version
MD4X-00-000700
Vuln IDs
  • V-252140
Rule IDs
  • SV-252140r879631_rule
Non-organizational users include all information system users other than organizational users, which include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors, guest researchers, individuals from allied nations). Non-organizational users must be uniquely identified and authenticated for all accesses other than those accesses explicitly identified and documented by the organization when related to the use of anonymous access, such as accessing a web server. Accordingly, a risk assessment is used in determining the authentication needs of the organization. Scalability, practicality, and security are simultaneously considered in balancing the need to ensure ease of use for access to federal information and information systems with the need to protect and adequately mitigate risk to organizational operations, organizational assets, individuals, other organizations, and the Nation.
Checks: C-55596r813800_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. Additionally, user-defined roles can be created. Check a user's role to ensure correct privileges for the function: Run the following command to get a list of all the databases in the system: show dbs For each database in the system, identify the user's roles for the database: use database db.getUsers() The server will return a document with the all users in the data and their associated roles. View a roles' privileges: For each database, identify the privileges granted by a role: use database db.getRole( %rolename%, { 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-55546r813801_fix

Administrators using MongoDB should document the appropriate privileges for various roles appropriate to the application. 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, run the following: db.revokeRolesFromUser( %username%, [ roles ], { writeConcern } ) To grant a role to a user run the following: db.grantRolesToUser( %username%, [ roles ], { writeConcern } )

b
MongoDB must fail to a secure state if system initialization fails, shutdown fails, or aborts fail.
SC-24 - Medium - CCI-001190 - V-252141 - SV-252141r879640_rule
RMF Control
SC-24
Severity
Medium
CCI
CCI-001190
Version
MD4X-00-000800
Vuln IDs
  • V-252141
Rule IDs
  • SV-252141r879640_rule
Failure to a known state can address safety or security in accordance with the mission/business needs of the organization. Failure to a known secure state helps prevent a loss of confidentiality, integrity, or availability in the event of a failure of the information system or a component of the system. Failure to a known safe state helps prevent systems from failing to a state that may cause loss of data or unauthorized access to system resources. Systems that fail suddenly and with no incorporated failure state planning may leave the hosting system available but with a reduced security protection capability. Preserving information system state data also facilitates system restart and return to the operational mode of the organization with less disruption of mission/business processes. Databases must fail to a known consistent state. Transactions must be successfully completed or rolled back. In general, security mechanisms should be designed so that a failure will follow the same execution path as disallowing the operation. For example, application security methods, such as isAuthorized(), isAuthenticated(), and validate(), should all return false if there is an exception during processing. If security controls can throw exceptions, they must be very clear about exactly what that condition means. Abort refers to stopping a program or function before it has finished naturally. The term abort refers to both requested and unexpected terminations. Satisfies: SRG-APP-000225-DB-000153, SRG-APP-000226-DB-000147
Checks: C-55597r813803_chk

Journaling is enabled by default. With journaling enabled, if mongod stops unexpectedly, the program can recover everything written to the journal. MongoDB will re-apply the write operations on restart and maintain a consistent state. To validate the mongod configuration, run the following command: db.getSiblingDB("admin").runCommand({getCmdLineOpts: 1}).parsed.storage.journal If it returns { enabled : false } or no output, this is a finding.

Fix: F-55547r813804_fix

Modify the mongod startup command-line options by removing the --nojournal option. Edit the MongoDB database configuration file (default location: /etc/mongod.conf) to ensure the option storage.journal.enabled is present and set to true as show below: storage: journal: enabled: true Stop/start (restart) any or all mongod or mongos processes.

b
MongoDB must prevent unauthorized and unintended information transfer via shared system resources.
SC-4 - Medium - CCI-001090 - V-252142 - SV-252142r879649_rule
RMF Control
SC-4
Severity
Medium
CCI
CCI-001090
Version
MD4X-00-000900
Vuln IDs
  • V-252142
Rule IDs
  • SV-252142r879649_rule
The purpose of this control is to prevent information, including encrypted representations of information, produced by the actions of a prior user/role (or the actions of a process acting on behalf of a prior user/role) from being available to any current user/role (or current process) that obtains access to a shared system resource (e.g., registers, main memory, secondary storage) after the resource has been released back to the information system. Control of information in shared resources is also referred to as object reuse. Satisfies: SRG-APP-000243-DB-000373, SRG-APP-000243-DB-000374
Checks: C-55598r817008_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-55548r813807_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

b
MongoDB and associated applications must reserve the use of dynamic code execution for situations that require it.
SI-10 - Medium - CCI-001310 - V-252143 - SV-252143r879652_rule
RMF Control
SI-10
Severity
Medium
CCI
CCI-001310
Version
MD4X-00-001000
Vuln IDs
  • V-252143
Rule IDs
  • SV-252143r879652_rule
With respect to database management systems, one class of threat is known as SQL Injection, or more generally, code injection. It takes advantage of the dynamic execution capabilities of various programming languages, including dialects of SQL. In such cases, the attacker deduces the manner in which SQL statements are being processed, either from inside knowledge or by observing system behavior in response to invalid inputs. When the attacker identifies scenarios where SQL queries are being assembled by application code (which may be within the database or separate from it) and executed dynamically, the attacker is then able to craft input strings that subvert the intent of the query. Potentially, the attacker can gain unauthorized access to data, including security settings, and severely corrupt or destroy the database. The principal protection against code injection is not to use dynamic execution except where it provides necessary functionality that cannot be utilized otherwise. Use strongly typed data items rather than general-purpose strings as input parameters to task-specific, pre-compiled stored procedures and functions (and triggers). This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered. Satisfies: SRG-APP-000251-DB-000391, SRG-APP-000251-DB-000392
Checks: C-55599r813809_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-55549r813810_fix

Disable the javascriptEnabled option. Edit the %MongoDB configuration file% (default location: /etc/mongod.conf) to include the following: security: javascriptEnabled: false

b
MongoDB must associate organization-defined types of security labels having organization-defined security label values with information in storage and transmission.
AC-16 - Medium - CCI-002262 - V-252144 - SV-252144r879689_rule
RMF Control
AC-16
Severity
Medium
CCI
CCI-002262
Version
MD4X-00-001100
Vuln IDs
  • V-252144
Rule IDs
  • SV-252144r879689_rule
Without the association of security labels to information, there is no basis for MongoDB to make security-related access-control decisions. Security labels are abstractions representing the basic properties or characteristics of an entity (e.g., subjects and objects) with respect to safeguarding information. These labels are typically associated with internal data structures (e.g., tables, rows) within the database and are used to enable the implementation of access control and flow control policies, reflect special dissemination, handling, or distribution instructions, or support other aspects of the information security policy. One example includes marking data as classified or CUI. These security labels may be assigned manually or during data processing, but, either way, it is imperative these assignments are maintained while the data is in storage. If the security labels are lost when the data is stored, there is the risk of a data compromise. The mechanism used to support security labeling may be a feature of MongoDB product, a third-party product, or custom application code. Satisfies: SRG-APP-000311-DB-000308, SRG-APP-000313-DB-000309, SRG-APP-000314-DB-000310
Checks: C-55600r855501_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 results returned from this command 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, which is a role that has been created and has access to read/view those database/collections that require security labels) and review the data in the MongoDB collections that require security labels to ensure that 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 be 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 that data in those collections use an appropriately constructed MongoDB $redact operation as part of the query pipeline to ensure that only the data appropriate for the query (that meets the security label requirements) is returned. Ensure that 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 how this is can be constructed can be found here: https://docs.mongodb.com/v4.4/reference/operator/aggregation/redact/ Any queries that target a MongoDB database/collection that has security labels and that pass through the trusted middleware and does not have an appropriately constructed $redact operator which is part of the query aggregation pipeline are 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-55550r855502_fix

If security labeling is required then ensure the following: 1. Organizational or site-specific documentation and guidance is available or developed. 2. Ensure that security labels are or have been applied to those 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. The example below shows 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 that 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 can be constructed can be found here: https://docs.mongodb.com/v4.4/reference/operator/aggregation/redact/

b
MongoDB must enforce discretionary access control policies, as defined by the data owner, over defined subjects and objects.
AC-3 - Medium - CCI-002165 - V-252145 - SV-252145r879705_rule
RMF Control
AC-3
Severity
Medium
CCI
CCI-002165
Version
MD4X-00-001200
Vuln IDs
  • V-252145
Rule IDs
  • SV-252145r879705_rule
Discretionary Access Control (DAC) is based on the notion that individual users are "owners" of objects and therefore have discretion over who should be authorized to access the object and in which mode (e.g., read or write). Ownership is usually acquired as a consequence of creating the object or via specified ownership assignment. DAC allows the owner to determine who will have access to objects they control. An example of DAC includes user-controlled table permissions. When discretionary access control policies are implemented, subjects are not constrained with regard to what actions they can take with information for which they have already been granted access. Thus, subjects that have been granted access to information are not prevented from passing (i.e., the subjects have the discretion to pass) the information to other subjects or objects. A subject that is constrained in its operation by Mandatory Access Control policies is still able to operate under the less rigorous constraints of this requirement. Thus, while Mandatory Access Control imposes constraints preventing a subject from passing information to another subject operating at a different sensitivity level, this requirement permits the subject to pass the information to any subject at the same sensitivity level. The policy is bound by the information system boundary. Once the information is passed outside of the control of the information system, additional means may be required to ensure the constraints remain in effect. While the older, more traditional definitions of discretionary access control require identity-based access control, that limitation is not required for this use of discretionary access control. Satisfies: SRG-APP-000328-DB-000301, SRG-APP-000340-DB-000304
Checks: C-55601r813815_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-55551r813816_fix

Enable authentication for MongoDB by following the instructions here: https://docs.mongodb.com/v4.4/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" }, "readWriteAnyDatabase" ] } ) Enable authorization by adding the following entry to the %MongoDB configuration file%: security: authorization: enabled Restart the MongoDB service from the OS. sudo service mongod restart The createUser and createRole MongoDB commands will be used to add the required users and roles per organizational or site-specific documentation. https://docs.mongodb.com/v4.4/reference/command/createUser/ https://docs.mongodb.com/v4.4/reference/command/createRole/

c
MongoDB must use NIST FIPS 140-2 or 140-3 validated cryptographic modules for cryptographic operations.
SC-13 - High - CCI-002450 - V-252146 - SV-252146r879616_rule
RMF Control
SC-13
Severity
High
CCI
CCI-002450
Version
MD4X-00-001300
Vuln IDs
  • V-252146
Rule IDs
  • SV-252146r879616_rule
The use of weak or not validated cryptographic algorithms undermines the purposes of utilizing encryption and digital signatures to protect data. Weak algorithms can be easily broken and not validated cryptographic modules may not implement algorithms correctly. Unapproved cryptographic modules or algorithms should not be relied on for authentication, confidentiality, or integrity. Weak cryptography could allow an attacker to gain access to and modify data stored in the database as well as the administration settings of MongoDB. Applications, including DBMSs, utilizing cryptography are required to use approved NIST FIPS 140-2 or 140-3 validated cryptographic modules that meet the requirements of applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance. NSA Type-X (where X=1, 2, 3, 4) products are NSA-certified, hardware-based encryption modules. The standard for validating cryptographic modules will transition to the NIST FIPS 140-3 publication. FIPS 140-2 modules can remain active for up to five years after validation or until September 21, 2026, when the FIPS 140-2 validations will be moved to the historical list. Even on the historical list, CMVP supports the purchase and use of these modules for existing systems. While Federal Agencies decide when they move to FIPS 140-3 only modules, purchasers are reminded that for several years there may be a limited selection of FIPS 140-3 modules from which to choose. CMVP recommends purchasers consider all modules that appear on the Validated Modules Search Page: https://csrc.nist.gov/projects/cryptographic-module-validation-program/validated-modules More information on the FIPS 140-3 transition can be found here: https://csrc.nist.gov/Projects/fips-140-3-transition-effort/ Satisfies: SRG-APP-000179-DB-000114, SRG-APP-000416-DB-000380, SRG-APP-000514-DB-000381, SRG-APP-000514-DB-000382, SRG-APP-000514- DB-000383
Checks: C-55602r813818_chk

Run the following command from the MongoDB shell: db.getSiblingDB("admin").runCommand({getCmdLineOpts: 1}).parsed.net.tls.FIPSMode If the MongoDB server is running with FIPS mode, this command will return true. Any other output is a finding. Verify that FIPS has been enabled at the OS level. Refer to the appropriate OS STIG documentation.

Fix: F-55552r863330_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 true Alternatively, run the following command to search the mongod logfile for FIPS 140-2 mode activated: grep "FIPS 140-2 mode activated" /var/log/mongodb/mongod.log For the operating system finding, refer to the appropriate operating system documentation for the procedure to install, configure, and test FIPS mode.

b
MongoDB must implement cryptographic mechanisms to prevent unauthorized modification of organization-defined information at rest (to include, at a minimum, PII and classified information) on organization-defined information system components.
SC-28 - Medium - CCI-002475 - V-252147 - SV-252147r879799_rule
RMF Control
SC-28
Severity
Medium
CCI
CCI-002475
Version
MD4X-00-001400
Vuln IDs
  • V-252147
Rule IDs
  • SV-252147r879799_rule
DBMSs handling data requiring "data at rest" protections must employ cryptographic mechanisms to prevent unauthorized disclosure and modification of the information at rest. These cryptographic mechanisms may be native to MongoDB or implemented via additional software or operating system/file system settings, as appropriate to the situation. Selection of a cryptographic mechanism is based on the need to protect the integrity of organizational information. The strength of the mechanism is commensurate with the security category and/or classification of the information. Organizations have the flexibility to either encrypt all information on storage devices (i.e., full disk encryption) or encrypt specific data structures (e.g., files, records, or fields). The decision whether and what to encrypt rests with the data owner and is also influenced by the physical measures taken to secure the equipment and media on which the information resides. Satisfies: SRG-APP-000428-DB-000386, SRG-APP-000429-DB-000387
Checks: C-55603r813821_chk

Review the system documentation to determine whether the organization has defined the information at rest that is to be protected from modification, which must include, at a minimum, PII and classified information. If no information is identified as requiring such protection, this is not a finding. If any data is PII, classified or is deemed by the organization the need to be encrypted at rest, verify the MongoDB configuration file (default location: /etc/mongod.conf) contain the following options: security: enableEncryption: true kmip: serverName: %KMIP Server HostName% port: %KMIP server port% ServerCAFile: %CA PEM file% clientCertificateFile: %client PEM file% If these above options are not part of the MongoDB configuration file, this is a finding. Items in the above are specific to the KMIP appliance and need to be set according to the KMIP appliance configuration.

Fix: F-55553r813822_fix

Configure MongoDB to use the Encrypted Storage Engine and a KMIP appliance as documented here: https://docs.mongodb.com/v4.4/core/security-encryption-at-rest/ https://docs.mongodb.com/v4.4/tutorial/configure-encryption/

b
MongoDB must limit the total number of concurrent connections to the database.
AC-10 - Medium - CCI-000054 - V-252148 - SV-252148r879511_rule
RMF Control
AC-10
Severity
Medium
CCI
CCI-000054
Version
MD4X-00-001550
Vuln IDs
  • V-252148
Rule IDs
  • SV-252148r879511_rule
MongoDB must limit the total number of concurrent connections to the database.
Checks: C-55604r813824_chk

Mongo can limit the total number of connections. Verify that 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 utilized to limit connections, this is a finding.

Fix: F-55554r813825_fix

MongoDB can limit the total number of connections served by mongod process by setting the following in the MongoDB configuration file (default location: /etc/mongod.conf) net: maxIncomingConnections: %int% See the following documentation: https://docs.mongodb.com/v4.4/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://docs.mongodb.com/v4.4/reference/ulimit/

c
MongoDB must integrate with an organization-level authentication/access mechanism providing account management and automation for all users, groups, roles, and any other principals.
AC-2 - High - CCI-000015 - V-252149 - SV-252149r879522_rule
RMF Control
AC-2
Severity
High
CCI
CCI-000015
Version
MD4X-00-001600
Vuln IDs
  • V-252149
Rule IDs
  • SV-252149r879522_rule
MongoDB must integrate with an organization-level authentication/access mechanism providing account management and automation for all users, groups, roles, and any other principals.
Checks: C-55605r813827_chk

Verify that 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. If using organization-mandated authorization, verify that the MongoDB configuration file (default location: /etc/mongod.conf) contains the following to ensure LDAP auth is enabled as well: security: ldap: servers: [list of ldap servers] If this parameter is not present, this is a finding.

Fix: F-55555r813828_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://docs.mongodb.com/v4.4/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 deployment. Configuration information for LDAP for MongoDB can be found here: https://docs.mongodb.com/v4.4/core/security-ldap-external/ https://docs.mongodb.com/v4.4/core/security-ldap-external/#configuration

c
MongoDB must enforce approved authorizations for logical access to information and system resources in accordance with applicable access control policies.
AC-3 - High - CCI-000213 - V-252150 - SV-252150r879530_rule
RMF Control
AC-3
Severity
High
CCI
CCI-000213
Version
MD4X-00-001700
Vuln IDs
  • V-252150
Rule IDs
  • SV-252150r879530_rule
MongoDB must enforce approved authorizations for logical access to information and system resources in accordance with applicable access control policies.
Checks: C-55606r813830_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. If the actual permissions do not match the documented requirements, this is a finding. Run MongoDB command to view roles and privileges in a particular database: use database db.getRoles( { rolesInfo: 1, showPrivileges:true, showBuiltinRoles: true } )

Fix: F-55556r813831_fix

Use createRole(), updateRole(), dropRole(), grantRole() statements to add and remove permissions on MongoDB serverl securables, bringing them into line with the documented requirements. MongoDB commands for role management can be found here: https://docs.mongodb.com/v4.4/reference/method/js-role-management/

b
MongoDB must limit privileges to change software modules, to include stored procedures, functions and triggers, and links to software external to MongoDB.
CM-5 - Medium - CCI-001499 - V-252151 - SV-252151r879586_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001499
Version
MD4X-00-002000
Vuln IDs
  • V-252151
Rule IDs
  • SV-252151r879586_rule
If the system were to allow any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. Accordingly, only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. Unmanaged changes that occur to the database software libraries or configuration can lead to unauthorized or compromised installations.
Checks: C-55607r813833_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. If monitoring does not occur or is not complete, this is a finding.

Fix: F-55557r813834_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, scripts can also be written 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.

c
MongoDB software installation account must be restricted to authorized users.
CM-5 - High - CCI-001499 - V-252152 - SV-252152r879586_rule
RMF Control
CM-5
Severity
High
CCI
CCI-001499
Version
MD4X-00-002100
Vuln IDs
  • V-252152
Rule IDs
  • SV-252152r879586_rule
When dealing with change control issues, it should be noted any changes to the hardware, software, and/or firmware components of the information system and/or application can have significant effects on the overall security of the system. If the system were to allow any user to make changes to software libraries, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. Accordingly, only qualified and authorized individuals must be allowed access to information system components for purposes of initiating changes, including upgrades and modifications. DBA and other privileged administrative or application owner accounts are granted privileges that allow actions that can have a great impact on database security and operation. It is especially important to grant privileged access to only those persons who are qualified and authorized to use them.
Checks: C-55608r813836_chk

Review procedures for controlling, granting access to, and tracking use of the DBMS software installation account. If access or use of this account is not restricted to the minimum number of personnel required or if unauthorized access to the account has been granted, this is a finding.

Fix: F-55558r813837_fix

Develop, document, and implement procedures to restrict and track use of the DBMS software installation account.

b
Database software, including DBMS configuration files, must be stored in dedicated directories, or DASD pools, separate from the host OS and other applications.
CM-5 - Medium - CCI-001499 - V-252153 - SV-252153r879586_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001499
Version
MD4X-00-002200
Vuln IDs
  • V-252153
Rule IDs
  • SV-252153r879586_rule
When dealing with change control issues, it should be noted any changes to the hardware, software, and/or firmware components of the information system and/or application can potentially have significant effects on the overall security of the system. Multiple applications can provide a cumulative negative effect. A vulnerability and subsequent exploit to one application can lead to an exploit of other applications sharing the same security context. For example, an exploit to a web server process that leads to unauthorized administrative access to host system directories can most likely lead to a compromise of all applications hosted by the same system. Database software not installed using dedicated directories both threatens and is threatened by other hosted applications. Access controls defined for one application may by default provide access to the other application's database objects or directories. Any method that provides any level of separation of security context assists in the protection between applications.
Checks: C-55609r813839_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) /var/lib/mongo/diagnostic.data /var/lib/mongo/_tmp /var/lib/mongo/journal /var/log/mongodb (the mongod process log directory) /var/log/mongodb/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 sub-directories. If any non-MongoDB application, non-MongoDB data, or non-MongoDB directories exists under the MongoDB-created directories, this is a finding.

Fix: F-55559r813840_fix

The official installation packages from MongoDB segregates 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 that is found under the MongoDB created directories that cannot be associated with a MongoDB application, move or delete that data from the MongoDB-created directories.

b
Database objects (including but not limited to tables, indexes, storage, stored procedures, functions, triggers, links to software external to MongoDB, etc.) must be owned by database/DBMS principals authorized for ownership.
CM-5 - Medium - CCI-001499 - V-252154 - SV-252154r879586_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001499
Version
MD4X-00-002300
Vuln IDs
  • V-252154
Rule IDs
  • SV-252154r879586_rule
Within the database, object ownership implies full privileges to the owned object, including the privilege to assign access to the owned objects to other subjects. Database functions and procedures can be coded using definer's rights. This allows anyone who utilizes the object to perform the actions if they were the owner. If not properly managed, this can lead to privileged actions being taken by unauthorized individuals. Conversely, if critical tables or other objects rely on unauthorized owner accounts, these objects may be lost when an account is removed.
Checks: C-55610r813842_chk

Run the following command to get the roles from a MongoDB database. For each database in MongoDB: use database db.getUsers() If the output shows a role of "dbOwner", this is a finding.

Fix: F-55560r813843_fix

For each user where the role of dbOwner is found verify whether or not the user is authorized for this role on the resources listed. This information will be found in the organizational or site-specific documentation. If a user if found not authorized to have the role dbOwner the remove that role from the user with the db.revokeRolesFromUser() command https://docs.mongodb.com/v4.4/reference/command/revokeRolesFromUser/

b
The role(s)/group(s) used to modify database structure (including but not necessarily limited to tables, indexes, storage, etc.) and logic modules (stored procedures, functions, triggers, links to software external to MongoDB, etc.) must be restricted to authorized users.
CM-5 - Medium - CCI-001499 - V-252155 - SV-252155r879586_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001499
Version
MD4X-00-002400
Vuln IDs
  • V-252155
Rule IDs
  • SV-252155r879586_rule
If MongoDB were to allow any user to make changes to database structure or logic, then those changes might be implemented without undergoing the appropriate testing and approvals that are part of a robust change management process. Accordingly, only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications. Unmanaged changes that occur to the database software libraries or configuration can lead to unauthorized or compromised installations.
Checks: C-55611r813845_chk

Run the following command to get the roles from a MongoDB database. For each database in MongoDB: 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-55561r813846_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://docs.mongodb.com/v4.4/reference/method/js-role-management/

b
Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled.
CM-7 - Medium - CCI-000381 - V-252156 - SV-252156r879587_rule
RMF Control
CM-7
Severity
Medium
CCI
CCI-000381
Version
MD4X-00-002600
Vuln IDs
  • V-252156
Rule IDs
  • SV-252156r879587_rule
Information systems are capable of providing a wide variety of functions and services. Some of the functions and services, provided by default, may not be necessary to support essential organizational operations (e.g., key missions, functions). It is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives. DBMSs must adhere to the principles of least functionality by providing only essential capabilities. Unused, unnecessary DBMS components increase the attack vector for MongoDB by introducing additional targets for attack. By minimizing the services and applications installed on the system, the number of potential vulnerabilities is reduced. Components of the system that are unused and cannot be uninstalled must be disabled. The techniques available for disabling components will vary by DBMS product, OS, and the nature of the component and may include DBMS configuration settings, OS service settings, OS file access security, and DBMS user/role permissions.
Checks: C-55612r813848_chk

In the MongoDB database configuration file (default location: /etc/mongod.conf), review the following parameters: net: http: enabled: true JSONPEnabled: true RESTInterfaceEnabled: true If any of the booleans are true or enabled, this is a finding.

Fix: F-55562r813849_fix

In the MongoDB database configuration file (default location: /etc/mongod.conf), ensure the following parameters either: Does not exist in the file OR Are set to false as shown below: http: enabled: false JSONPEnabled: false RESTInterfaceEnabled: false

b
MongoDB must uniquely identify and authenticate organizational users (or processes acting on behalf of organizational users).
IA-2 - Medium - CCI-000764 - V-252157 - SV-252157r879589_rule
RMF Control
IA-2
Severity
Medium
CCI
CCI-000764
Version
MD4X-00-002800
Vuln IDs
  • V-252157
Rule IDs
  • SV-252157r879589_rule
To assure accountability and prevent unauthenticated access, organizational users must be identified and authenticated to prevent potential misuse and compromise of the system. Organizational users include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors). Organizational users (and any processes acting on behalf of users) must be uniquely identified and authenticated for all accesses, except the following: (i) Accesses explicitly identified and documented by the organization. Organizations document specific user actions that can be performed on the information system without identification or authentication; and (ii) Accesses that occur through authorized use of group authenticators without individual authentication. Organizations may require unique identification of individuals using shared accounts, for detailed accountability of individual activity.
Checks: C-55613r813851_chk

For each database in the system, run the following command: use database db.getUsers() Ensure 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 that 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-55563r813852_fix

For any user not a member of an appropriate organization and has access to a database in the system, run the following command: use database db.dropUser(%username%, {w: "majority", wtimeout: 5000}) If the %MongoDB configuration file% (default location: /etc/mongod.conf) does not contain security: authorization: enabled Edit the %MongoDB configuration file%, add these parameters, stop/start (restart) any mongod or mongos process using this %MongoDB configuration file%.

c
If passwords are used for authentication, MongoDB must implement LDAP or Kerberos for authentication to enforce the DoD standards for password complexity and lifetime.
IA-5 - High - CCI-000192 - V-252158 - SV-252158r879601_rule
RMF Control
IA-5
Severity
High
CCI
CCI-000192
Version
MD4X-00-002950
Vuln IDs
  • V-252158
Rule IDs
  • SV-252158r879601_rule
OS/enterprise authentication and identification must be used (SRG-APP-000023-DB-000001). Native DBMS authentication may be used only when circumstances make it unavoidable, and must be documented and AO-approved. The DoD standard for authentication is DoD-approved PKI certificates. Authentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate, and requires AO approval. In such cases, the DoD standards for password complexity and lifetime must be implemented. DBMS products that can inherit the rules for these from the operating system or access control program (e.g., Microsoft Active Directory) must be configured to do so. For other DBMSs, the rules must be enforced using available configuration parameters or custom code. For MongoDB, password complexity and lifetime requirements must be enforced by an external authentication source such as LDAP, Active Directory, or Kerberos.
Checks: C-55614r813854_chk

If MongoDB is using Native LDAP authentication where the LDAP server is configured to enforce password complexity and lifetime, this is not a finding. If MongoDB is using Kerberos authentication where Kerberos is configured to enforce password complexity and lifetime, this is not a finding. If MongoDB is not configured for SCRAM-SHA1, MONGODB-CR, or LDAP authentication, this is a finding.

Fix: F-55564r813855_fix

Password complexity and lifetime must be enforced by an external authentication source such as LDAP, Active Directory, or Kerberos. Information on configuring MongoDB for one of these authentication mechanisms be found here: LDAP/Active Directory: https://docs.mongodb.com/v4.4/tutorial/authenticate-nativeldap-activedirectory/ Kerberos: https://docs.mongodb.com/v4.4/tutorial/control-access-to-mongodb-with-kerberos-authentication/

c
If passwords are used for authentication, MongoDB must store only hashed, salted representations of passwords.
IA-5 - High - CCI-000196 - V-252159 - SV-252159r879608_rule
RMF Control
IA-5
Severity
High
CCI
CCI-000196
Version
MD4X-00-003000
Vuln IDs
  • V-252159
Rule IDs
  • SV-252159r879608_rule
The DoD standard for authentication is DoD-approved PKI certificates. Authentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate, and requires AO approval. In such cases, database passwords stored in clear text, using reversible encryption, or using unsalted hashes would be vulnerable to unauthorized disclosure. Database passwords must always be in the form of one-way, salted hashes when stored internally or externally to MongoDB.
Checks: C-55615r863322_chk

MongoDB supports several authentication mechanisms, some of which store credentials on the MongoDB server. If these mechanisms are in use, MongoDBs authSchemaVersion in the admin.system.version collection must be set to 5. 1. Validate that authenticationMechansisms is defined in config file (default location /etc/mongod.conf). The MongoDB Configuration file should contain the similar to the following entry: setParameter: authenticationMechanisms: SCRAM-SHA-256 If the config file does not contain an authenticationMechanisms entry, this is a finding. 2. Validate authSchemaVersion is set to 5. Using the shell, run the following command: db.getSiblingDB("admin").system.version.find({ "_id" : "authSchema"}, {_id: 0}) It should return: { "currentVersion" : 5 } If currentVersion is less than 5, this is a finding.

Fix: F-55565r863323_fix

1. If authenticationMechanisms is not defined in the %MongoDB configuration file% (default location: /etc/mongod.conf), define one of more authenticationMechanisms, from the subset below: SCRAM-SHA-1 SCRAM-SHA-256 MONGODB-X509 GSSAPI PLAIN which the MongoDB server process must accept. Example: setParameter: authenticationMechanisms: SCRAM-SHA-1,SCRAM-SHA-256 2. If authSchemaVersion is less than 5. Run the following command: db.adminCommand({authSchemaUpgrade: 1}) In the unlikely event that an error is encountered, safely rerun the authSchemaUpgrade command.

c
MongoDB must enforce authorized access to all PKI private keys stored/utilized by MongoDB.
IA-5 - High - CCI-000186 - V-252160 - SV-252160r879613_rule
RMF Control
IA-5
Severity
High
CCI
CCI-000186
Version
MD4X-00-003100
Vuln IDs
  • V-252160
Rule IDs
  • SV-252160r879613_rule
The DoD standard for authentication is DoD-approved PKI certificates. PKI certificate-based authentication is performed by requiring the certificate holder to cryptographically prove possession of the corresponding private key. If the private key is stolen, an attacker can use the private key(s) to impersonate the certificate holder. In cases where MongoDB-stored private keys are used to authenticate MongoDB to the system's clients, loss of the corresponding private keys would allow an attacker to successfully perform undetected man in the middle attacks against MongoDB system and its clients. Both the holder of a digital certificate and the issuing authority must take careful measures to protect the corresponding private key. Private keys should always be generated and protected in FIPS 140-2 or 140-3 validated cryptographic modules. All access to the private key(s) of MongoDB must be restricted to authorized and authenticated users. If unauthorized users have access to one or more of MongoDB's private keys, an attacker could gain access to the key(s) and use them to impersonate the database on the network or otherwise perform unauthorized actions.
Checks: C-55616r813860_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/caToValidateClientCertificates.pem Verify ownership, group ownership, and permissions for the MongoDB config file (default: /etc/mongod.conf), the PEMKeyFile (default /etc/ssl/mongodb.pem), and the CAFile (default /etc/ssl/caToValidateClientCertificates.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-55566r813861_fix

To set proper ownership, group ownership, and permissions, run these commands: chown mongod:mongod /etc/ssl/mongodb.pem chmod 600 /etc/ssl/mongodb.pem chown mongod:mongod /etc/ssl/caToValidateClientCertificates.pem chmod 600 /etc/ssl/caToValidateClientCertificates.pem

b
MongoDB must map the PKI-authenticated identity to an associated user account.
IA-5 - Medium - CCI-000187 - V-252161 - SV-252161r879614_rule
RMF Control
IA-5
Severity
Medium
CCI
CCI-000187
Version
MD4X-00-003200
Vuln IDs
  • V-252161
Rule IDs
  • SV-252161r879614_rule
The DoD standard for authentication is DoD-approved PKI certificates. Once a PKI certificate has been validated, it must be mapped to a DBMS user account for the authenticated identity to be meaningful to MongoDB and useful for authorization decisions.
Checks: C-55617r813863_chk

If using LDAP for authentication, this is not applicable. Each unique x.509 client certificate corresponds to a single MongoDB user; meaning it cannot use a single-client certificate to authenticate more than one MongoDB user. Log in to MongoDB and run the following command: db.runCommand( {connectionStatus: 1} ); Example output being: 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 certs Subject Name, this is a finding.

Fix: F-55567r813864_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 it cannot use a single-client certificate to 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. See 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%)

c
MongoDB must obscure feedback of authentication information during the authentication process to protect the information from possible exploitation/use by unauthorized individuals.
IA-6 - High - CCI-000206 - V-252162 - SV-252162r879615_rule
RMF Control
IA-6
Severity
High
CCI
CCI-000206
Version
MD4X-00-003300
Vuln IDs
  • V-252162
Rule IDs
  • SV-252162r879615_rule
The DoD standard for authentication is DoD-approved PKI certificates. Normally, with PKI authentication, the interaction with the user for authentication will be handled by a software component separate from MongoDB, such as ActivIdentity ActivClient. However, in cases where MongoDB controls the interaction, this requirement applies. To prevent the compromise of authentication information such as passwords and PINs during the authentication process, the feedback from the system must not provide any information that would allow an unauthorized user to compromise the authentication mechanism. Obfuscation of user-provided authentication secrets when typed into the system is a method used in addressing this risk. Displaying asterisks when a user types in a password or a smart card PIN is an example of obscuring feedback of authentication secrets. This calls for review of applications, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-55618r813866_chk

Restrict the environment to tools which meet this requirement. For the MongoDB command-line tools mongo shell, 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 that the system documentation explains the need for the tool, who uses it, and any relevant mitigations and that AO approval has been obtained. If it is not documented, this is a finding. Request evidence that all users of MongoDB command-line tools are trained in the use of the -p 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-55568r813867_fix

For the mongo shell, 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.

b
MongoDB must uniquely identify and authenticate non-organizational users (or processes acting on behalf of non-organizational users).
IA-8 - Medium - CCI-000804 - V-252163 - SV-252163r879617_rule
RMF Control
IA-8
Severity
Medium
CCI
CCI-000804
Version
MD4X-00-003400
Vuln IDs
  • V-252163
Rule IDs
  • SV-252163r879617_rule
Non-organizational users include all information system users other than organizational users, which include organizational employees or individuals the organization deems to have equivalent status of employees (e.g., contractors, guest researchers, individuals from allied nations). Non-organizational users must be uniquely identified and authenticated for all accesses other than those accesses explicitly identified and documented by the organization when related to the use of anonymous access, such as accessing a web server. Accordingly, a risk assessment is used in determining the authentication needs of the organization. Scalability, practicality, and security are simultaneously considered in balancing the need to ensure ease of use for access to federal information and information systems with the need to protect and adequately mitigate risk to organizational operations, organizational assets, individuals, other organizations, and the Nation.
Checks: C-55619r817010_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. Additionally, one may create user-defined roles. Check a user's role to ensure correct privileges for the function: Prereq: To view a user's roles, you 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 roles' privileges: Prereq: To view a user's roles, you 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-55569r813870_fix

Administrators using MongoDB should document the appropriate privileges for various roles appropriate to the application. Prereq: To view a user's roles, 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.

b
MongoDB must maintain the authenticity of communications sessions by guarding against man-in-the-middle attacks that guess at Session ID values.
SC-23 - Medium - CCI-001188 - V-252164 - SV-252164r879639_rule
RMF Control
SC-23
Severity
Medium
CCI
CCI-001188
Version
MD4X-00-003700
Vuln IDs
  • V-252164
Rule IDs
  • SV-252164r879639_rule
One class of man-in-the-middle, or session hijacking, attack involves the adversary guessing at valid session identifiers based on patterns in identifiers already known. The preferred technique for thwarting guesses at Session IDs is the generation of unique session identifiers using a FIPS 140-2 or 140-3 approved random number generator. However, it is recognized that available DBMS products do not all implement the preferred technique yet may have other protections against session hijacking. Therefore, other techniques are acceptable, provided they are demonstrated to be effective.
Checks: C-55620r863327_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-55570r813873_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 Stop/start (restart) and mongod or mongos using the %MongoDB configuration file%. Further documentation is here: https://docs.mongodb.com/v4.4/tutorial/configure-ssl/.

c
MongoDB must protect the confidentiality and integrity of all information at rest.
SC-28 - High - CCI-001199 - V-252165 - SV-252165r879642_rule
RMF Control
SC-28
Severity
High
CCI
CCI-001199
Version
MD4X-00-003800
Vuln IDs
  • V-252165
Rule IDs
  • SV-252165r879642_rule
This control is intended to address the confidentiality and integrity of information at rest in non-mobile devices and covers user information and system information. Information at rest refers to the state of information when it is located on a secondary storage device (e.g., disk drive, tape drive) within an organizational information system. Applications and application users generate information throughout the course of their application use. User data generated, as well as application-specific configuration data, needs to be protected. Organizations may choose to employ different mechanisms to achieve confidentiality and integrity protections, as appropriate. If the confidentiality and integrity of application data is not protected, the data will be open to compromise and unauthorized modification.
Checks: C-55621r813875_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. Next, 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. Finally, validate that 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-55571r813876_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://docs.mongodb.com/v4.4/tutorial/configure-encryption/

b
Database contents must be protected from unauthorized and unintended information transfer by enforcement of a data-transfer policy.
SC-4 - Medium - CCI-001090 - V-252166 - SV-252166r879649_rule
RMF Control
SC-4
Severity
Medium
CCI
CCI-001090
Version
MD4X-00-004000
Vuln IDs
  • V-252166
Rule IDs
  • SV-252166r879649_rule
Applications, including DBMSs, must prevent unauthorized and unintended information transfer via shared system resources. Data used for the development and testing of applications often involves copying data from production. It is important that specific procedures exist for this process, to include the conditions under which such transfer may take place, where the copies may reside, and the rules for ensuring sensitive data are not exposed. Copies of sensitive data must not be misplaced or left in a temporary location without the proper controls.
Checks: C-55622r813878_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-55572r813879_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.

b
MongoDB must check the validity of all data inputs except those specifically identified by the organization.
SI-10 - Medium - CCI-001310 - V-252167 - SV-252167r879652_rule
RMF Control
SI-10
Severity
Medium
CCI
CCI-001310
Version
MD4X-00-004100
Vuln IDs
  • V-252167
Rule IDs
  • SV-252167r879652_rule
Invalid user input occurs when a user inserts data or characters into an application's data entry fields and the application is unprepared to process that data. This results in unanticipated application behavior, potentially leading to an application or information system compromise. Invalid user input is one of the primary methods employed when attempting to compromise an application. With respect to database management systems, one class of threat is known as SQL Injection, or more generally, code injection. It takes advantage of the dynamic execution capabilities of various programming languages, including dialects of SQL. Potentially, the attacker can gain unauthorized access to data, including security settings, and severely corrupt or destroy the database. Even when no such hijacking takes place, invalid input that gets recorded in the database, whether accidental or malicious, reduces the reliability and usability of the system. Available protections include data types, referential constraints, uniqueness constraints, range checking, and application-specific logic. Application-specific logic can be implemented within the database in stored procedures and triggers, where appropriate. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-55623r813881_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, e.g.: Error: error: { "ok" : 0, "errmsg" : "no globalScriptEngine in $where parsing", "code" : 2, "codeName" : "BadValue" }

Fix: F-55573r813882_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 should be configured according to the documentation page at: https://docs.mongodb.com/v4.4/core/schema-validation/

b
MongoDB must provide non-privileged users with error messages that provide information necessary for corrective actions without revealing information that could be exploited by adversaries.
SI-11 - Medium - CCI-001312 - V-252168 - SV-252168r879655_rule
RMF Control
SI-11
Severity
Medium
CCI
CCI-001312
Version
MD4X-00-004200
Vuln IDs
  • V-252168
Rule IDs
  • SV-252168r879655_rule
Any DBMS or associated application providing too much information in error messages on the screen or printout risks compromising the data and security of the system. The structure and content of error messages need to be carefully considered by the organization and development team. Databases can inadvertently provide a wealth of information to an attacker through improperly handled error messages. In addition to sensitive business or personal information, database errors can provide host names, IP addresses, user names, and other system information not required for troubleshooting but very useful to someone targeting the system. Carefully consider the structure/content of error messages. The extent to which information systems are able to identify and handle error conditions is guided by organizational policy and operational requirements. Information that could be exploited by adversaries includes, for example, logon attempts with passwords entered by mistake as the username, mission/business information that can be derived from (if not stated explicitly by) information recorded, and personal information, such as account numbers, social security numbers, and credit card numbers. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-55624r813884_chk

Check custom application code to verify that 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 login 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 or not. 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 identify the level of 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-55574r813885_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 do the following: 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 service mongod restart

b
MongoDB must reveal detailed error messages only to the ISSO, ISSM, SA, and DBA.
SI-11 - Medium - CCI-001314 - V-252169 - SV-252169r879656_rule
RMF Control
SI-11
Severity
Medium
CCI
CCI-001314
Version
MD4X-00-004300
Vuln IDs
  • V-252169
Rule IDs
  • SV-252169r879656_rule
If MongoDB provides too much information in error logs and administrative messages to the screen, this could lead to compromise. The structure and content of error messages need to be carefully considered by the organization and development team. The extent to which the information system is able to identify and handle error conditions is guided by organizational policy and operational requirements. Some default DBMS error messages can contain information that could aid an attacker in, among other things, identifying the database type, host address, or state of the database. Custom errors may contain sensitive customer information. It is important that detailed error messages be visible only to those who are authorized to view them; that general users receive only generalized acknowledgment that errors have occurred; and that these generalized messages appear only when relevant to the user's task. For example, a message along the lines of, "An error has occurred. Unable to save your changes. If this problem persists, contact your help desk" would be relevant. A message such as "Warning: your transaction generated a large number of page splits" would likely not be relevant. Administrative users authorized to review detailed error messages typically are the ISSO, ISSM, SA, and DBA. Other individuals or roles may be specified according to organization-specific needs, with appropriate approval. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-55625r813887_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 identify the level of 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 is an administrative command that will return the most recent 1024 logged mongod events. 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 see actions its permitted to perform on the cluster resource: db.runCommand({usersInfo: %username%, showPrivileges: 1}).users[0].inheritedPrivileges.filter(privilege = privilege.resource.cluster) If getLog appears in the list of actions, this is a finding.

Fix: F-55575r813888_fix

Edit the %MongoDB configuration file% (default location: /etc/mongod.conf) and add the following parameter redactClientLogData in the security section of that file: security: redactClientLogData: true Stop/start (restart) any mongod or mongos using the %MongoDB configuration file%. Identify and remove any administrative roles and privileges from application users.

b
MongoDB must automatically terminate a user session after organization-defined conditions or trigger events requiring session disconnect.
AC-12 - Medium - CCI-002361 - V-252170 - SV-252170r879673_rule
RMF Control
AC-12
Severity
Medium
CCI
CCI-002361
Version
MD4X-00-004400
Vuln IDs
  • V-252170
Rule IDs
  • SV-252170r879673_rule
This addresses the termination of user-initiated logical sessions in contrast to the termination of network connections that are associated with communications sessions (i.e., network disconnect). A logical session (for local, network, and remote access) is initiated whenever a user (or process acting on behalf of a user) accesses an organizational information system. Such user sessions can be terminated (and thus terminate user access) without terminating network sessions. Session termination ends all processes associated with a user's logical session except those batch processes/jobs that are specifically created by the user (i.e., session owner) to continue after the session is terminated. Conditions or trigger events requiring automatic session termination can include, for example, organization-defined periods of user inactivity, targeted responses to certain types of incidents, and time-of-day restrictions on information system use. This capability is typically reserved for specific cases where the system owner, data owner, or organization requires additional assurance.
Checks: C-55626r813890_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. If the system owner, data owner, or organization requires additional assurance, this is a finding.

Fix: F-55576r813891_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/v4.4/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/v4.4/reference/command/killAllSessionsByPattern/

b
MongoDB must utilize centralized management of the content captured in audit records generated by all components of MongoDB.
AU-3 - Medium - CCI-001844 - V-252171 - SV-252171r879729_rule
RMF Control
AU-3
Severity
Medium
CCI
CCI-001844
Version
MD4X-00-004800
Vuln IDs
  • V-252171
Rule IDs
  • SV-252171r879729_rule
Without the ability to centrally manage the content captured in the audit records, identification, troubleshooting, and correlation of suspicious behavior would be difficult and could lead to a delayed or incomplete analysis of an ongoing attack. The content captured in audit records must be managed from a central location (necessitating automation). Centralized management of audit records and logs provides for efficiency in maintenance and management of records, as well as the backup and archiving of those records. MongoDB may write audit records to database tables, to files in the file system, to other kinds of local repository, or directly to a centralized log management system. Whatever the method used, it must be compatible with off-loading the records to the centralized system.
Checks: C-55627r813893_chk

Administrators can implement collection-level access control through user-defined roles. By creating a role with privileges that are scoped to a specific collection in a particular database, administrators can provision users with roles that grant privileges on a collection level. For example, a user defined role can contain the following privileges: Once enabled, the auditing system can record the following operations: schema changes (DDL), replica set and sharded cluster, authentication and authorization, and CRUD operations (requires auditAuthorizationSuccess set to true). For details on audited actions, see MongoDB documentation on the complete configuration of Audit Event Actions, Details, and Results, and Configuring Audit Filters. To ensure auditing is enabled, confirm the auditLog section in the /etc/mongod.conf configuration file exists and has been set. For example, to enable syslog centralized logging of audit events, in the MongoDB configuration file (by default: /etc/mongod.conf) verify the destination type is set as: auditLog: destination: file format: BSON path: /var/log/mongodb/audit/auditLog.bson -OR- auditLog: destination: syslog If this is not present, is empty, or commented, this is a finding. Review the system documentation for a description of how audit records are off-loaded and how local audit log space is managed. If the DBMS audit records are not written directly to or systematically transferred to a centralized log management system, this is a finding.

Fix: F-55577r813894_fix

If audit operations filters are not configured in the MongoDB configuration file (default location: /etc/mongod.conf), configure them according to application requirements, but at a minimum, ensure destination and filter are set in a mongod.conf YAML auditLog configuration setting. For example, to audit all database operations involving creating or dropping a collection, the %MongoDB configuration file% (by default /etc/mongod.conf) auditLog section would read as follows: auditLog: destination: file format: BSON path: /var/log/mongodb/audit/auditLog.bson filter: '{ atype: { $in: [ "createCollection", "dropCollection" ] } }' See mongodb documentation for details of audit operations and event configuration. https://docs.mongodb.com/v4.4/core/auditing/ https://docs.mongodb.com/v4.4/tutorial/configure-audit-filters/ Configure and/or deploy software tools to ensure that DBMS audit records are written directly to or systematically transferred to a centralized log management system.

b
MongoDB must allocate audit record storage capacity in accordance with site audit record storage requirements.
AU-4 - Medium - CCI-001849 - V-252172 - SV-252172r879730_rule
RMF Control
AU-4
Severity
Medium
CCI
CCI-001849
Version
MD4X-00-004900
Vuln IDs
  • V-252172
Rule IDs
  • SV-252172r879730_rule
In order to ensure sufficient storage capacity for the audit logs, MongoDB must be able to allocate audit record storage capacity. Although another requirement (SRG-APP-000515-DB-000318) mandates that audit data be off-loaded to a centralized log management system, it remains necessary to provide space on the database server to serve as a buffer against outages and capacity limits of the off-loading mechanism. The task of allocating audit record storage capacity is usually performed during initial installation of MongoDB and is closely associated with the DBA and system administrator roles. The DBA or system administrator will usually coordinate the allocation of physical drive space with the application owner/installer and the application will prompt the installer to provide the capacity information, the physical location of the disk, or both. In determining the capacity requirements, consider such factors as: total number of users; expected number of concurrent users during busy periods; number and type of events being monitored; types and amounts of data being captured; the frequency/speed with which audit records are off-loaded to the central log management system; and any limitations that exist on MongoDB's ability to reuse the space formerly occupied by off-loaded records.
Checks: C-55628r813896_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. If there have been incidents where MongoDB ran out of audit log space, this is a finding.

Fix: F-55578r813897_fix

If an auditLog has not been specified, or a centralized system log (which is recommended) has not been enabled, configure these in the mongod.conf configuration file: auditLog: destination: syslog See documentation for additional configuration: https://docs.mongodb.com/v4.4/tutorial/configure-auditing/ Allocate sufficient space to the storage volume hosting the file identified in the MongoDB configuration "auditLog.path" to support audit file peak demand.

b
MongoDB must provide a warning to appropriate support staff when allocated audit record storage volume reaches 75 percent of maximum audit record storage capacity.
AU-5 - Medium - CCI-001855 - V-252173 - SV-252173r879732_rule
RMF Control
AU-5
Severity
Medium
CCI
CCI-001855
Version
MD4X-00-005000
Vuln IDs
  • V-252173
Rule IDs
  • SV-252173r879732_rule
Organizations are required to use a central log management system; so, under normal conditions, the audit space allocated to MongoDB on its own server will not be an issue. However, space will still be required on MongoDB server for audit records in transit, and, under abnormal conditions, this could fill up. Since a requirement exists to halt processing upon audit failure, a service outage would result. If support personnel are not notified immediately upon storage volume utilization reaching 75 percent, they are unable to plan for storage capacity expansion. The appropriate support staff include, at a minimum, the ISSO and the DBA/SA.
Checks: C-55629r813899_chk

Verify that auditing is enabled in the mongodb configuration file (default location: /etc/mongod.conf) and view the auditlog.path to identify the storage volume. This is only applicable where the auditLog.destination is set to file. Verify that MongoDB Ops Manager or other organization approved monitoring software is installed. Verify that the required alert in the monitoring software to send an alert where 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-55579r813900_fix

View the %MongoDB configuration file% (default location: /etc/mongod.conf) and view the auditlog.path to identify the storage volume. Install MongoDB Ops Manager or other organization-approved monitoring software. Configure the required alert in the monitoring software to send an alert where storage volume holding the auditLog file utilization reaches 75 percent.

b
MongoDB must prohibit user installation of logic modules (stored procedures, functions, triggers, views, etc.) without explicit privileged status.
CM-11 - Medium - CCI-001812 - V-252174 - SV-252174r879751_rule
RMF Control
CM-11
Severity
Medium
CCI
CCI-001812
Version
MD4X-00-005300
Vuln IDs
  • V-252174
Rule IDs
  • SV-252174r879751_rule
Allowing regular users to install software, without explicit privileges, creates the risk that untested or potentially malicious software will be installed on the system. Explicit privileges (escalated or administrative privileges) provide the regular user with explicit capabilities and control that exceed the rights of a regular user. DBMS functionality and the nature and requirements of databases will vary; so while users are not permitted to install unapproved software, there may be instances where the organization allows the user to install approved software packages such as from an approved software repository. The requirements for production servers will be more restrictive than those used for development and research. MongoDB must enforce software installation by users based upon what types of software installations are permitted (e.g., updates and security patches to existing software) and what types of installations are prohibited (e.g., software whose pedigree with regard to being potentially malicious is unknown or suspect) by the organization). In the case of a database management system, this requirement covers stored procedures, functions, triggers, views, etc.
Checks: C-55630r855511_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 only supports views and Change Streams (similar to triggers). Stored procedures and functions that are commonly found in relational databases are not supported by MongoDB. Connect to MongoDB and authenticate as a user that has Database Administrator privileges. Check each user of the database to verify that only authorized administrative users are granted the following privileges: createCollection and changeStream Run the following command to get a list of all the databases in the system: show dbs For each database in the system, identify any non-administrative users roles for the database: use database db.getUsers() The server will return a document with the all users in the data and their associated roles. Organizational or site-specific documentation should identify which administrative and non-administrative users exist. For each role that a non-administrative user has in the database find the privileges each role has: db.getRole(rolename, { showPrivileges: true }) If any non-administrative user has a role that where the resource has the action of createCollections or changeStream this is a finding.

Fix: F-55580r813903_fix

Document and obtain approval for any non-administrative users to have roles that contain createCollections or changeSteam actions on resources. For any non-administrative user that does not have approval, revoke these specific privileges from that non-administrative users role. Run the following commands in each database and for each non-administrative user that does not have approval to use the createCollections or changeStream actions on MongoDB resources: use database db.revokePrivilegesFromRole( rolename, [ { resource: { resource }, actions: [ action, ... ] }, ... ], { writeConcern } ) In the above command the action will be either createCollections or changeStream. There may be several resources in a role that contain these privileges and the removal process will require running the following command for each one.

b
MongoDB must enforce access restrictions associated with changes to the configuration of MongoDB or database(s).
CM-5 - Medium - CCI-001813 - V-252175 - SV-252175r879753_rule
RMF Control
CM-5
Severity
Medium
CCI
CCI-001813
Version
MD4X-00-005400
Vuln IDs
  • V-252175
Rule IDs
  • SV-252175r879753_rule
Failure to provide logical access restrictions associated with changes to configuration may have significant effects on the overall security of the system. When dealing with access restrictions pertaining to change control, it should be noted that any changes to the hardware, software, and/or firmware components of the information system can potentially have significant effects on the overall security of the system. Accordingly, only qualified and authorized individuals should be allowed to obtain access to system components for the purposes of initiating changes, including upgrades and modifications.
Checks: C-55631r855513_chk

To verify that access restrictions are being enforced, create a test user and a custom role and then confirm expected operations: Once authenticated as a DBA 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, then log 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.insert( { x: 1 } ) This operation will fail with a WriteResult error: WriteCommandError({ "ok" : 0, "errmsg" : "not authorized on test to execute command { insert: \"###\", ordered: \"###\", lsid: { id: \"###\" }, $db: \"###\" }", "code" : 13, "codeName" : "Unauthorized" }) If the operation does not fail, this is a finding.

Fix: F-55581r855514_fix

Verify that authentication has been enabled in the %MongoDB configuration file%: https://docs.mongodb.com/v4.4/reference/configuration-options/. If authorization is enabled, review the following to list existing user permissions. https://docs.mongodb.com/v4.4/reference/privilege-actions/ Connect to MongoDB. For each database (show dbs), 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 method below: db.revokeRolesFromUser( %username%, [ roles ], { writeConcern } ) https://docs.mongodb.com/v4.4/reference/method/db.revokeRolesFromUser/ To grant a role to a user, use the method below: db.grantRolesToUser( %username%, [ roles ], { writeConcern } ) https://docs.mongodb.com/v4.4/reference/method/db.grantRolesToUser/

b
MongoDB must require users to reauthenticate when organization-defined circumstances or situations require reauthentication.
IA-11 - Medium - CCI-002038 - V-252176 - SV-252176r879762_rule
RMF Control
IA-11
Severity
Medium
CCI
CCI-002038
Version
MD4X-00-005600
Vuln IDs
  • V-252176
Rule IDs
  • SV-252176r879762_rule
The DoD standard for authentication of an interactive user is the presentation of a Common Access Card (CAC) or other physical token bearing a valid, current, DoD-issued Public Key Infrastructure (PKI) certificate, coupled with a Personal Identification Number (PIN) to be entered by the user at the beginning of each session and whenever reauthentication is required. Without reauthentication, users may access resources or perform tasks for which they do not have authorization. When applications provide the capability to change security roles or escalate the functional capability of the application, it is critical the user reauthenticate. In addition to the reauthentication requirements associated with session locks, organizations may require reauthentication of individuals and/or devices in other situations, including (but not limited to) the following circumstances: (i) When authenticators change; (ii) When roles change; (iii) When security categories of information systems change; (iv) When the execution of privileged functions occurs; (v) After a fixed period of time; or (vi) Periodically. Within the DoD, the minimum circumstances requiring reauthentication are privilege escalation and role changes.
Checks: C-55632r855516_chk

MongoDB Enterprise supports PKI x.509 certificate bearer authentication. The duration of a user's logical session is application-specific, but is verified on initial network session connection. Additional user authentication controls can be enabled on a client basis (including Windows OS-level CAC + PIN flow; see operating system documentation for specific configuration). By specifying both the database and the collection in the resource document for a privilege, administrator can limit the privilege actions just to a specific collection in a specific database. Each privilege action in a role can be scoped to a different collection. When a new privilege is applied to an object, such as a particular collection or a database, authorization to access that object is verified at run-time (i.e., in real time). To check that authorization is being enforced, see the documentation for Collection-Level Access Control and custom user roles (https://docs.mongodb.com/v4.4/core/collection-level-access-control/) and create a new role with the following permissions, e.g.: use admin db.createRole( { role: "myTestRole", privileges: [ { resource: { db: "products", collection: "inventory" }, actions: [ "find", "update", "insert" ] }, { resource: { db: "products", collection: "orders" }, actions: [ "find" ] } ], roles: [ ] }, { w: "majority" , wtimeout: 5000 } ) Assign that privilege to one or more users. use products db.createUser({user: "myRoleTestUser", pwd: "password1", roles: ["myTestRole"]}) Log in as "myRoleTestUser" user and attempt find(), insert() and delete() operations on a test inventory and orders collection. The following commands will succeed: use products db.inventory.insert({a: 1}) db.inventory.find() db.inventory.update({a:1}, {$set: {"updated": true}}) Example output of the above commands: use products switched to db products db.inventory.find() db.inventory.insert({a: 1}) WriteResult({ "nInserted" : 1 }) db.inventory.update({a:1}, {$set: {"updated": true}}) WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 0 }) Of the following ONLY the find() will succeed: use products switched to db products use products db.orders.find() db.orders.insert({a: 1}) db.orders.update({a:1}, {$set: {"updated": true}}) Example output: db.orders.find() db.orders.insert({a: 1}) WriteCommandError({ "ok" : 0, "errmsg" : "not authorized on products to execute command { insert: \"###\", ordered: \"###\", lsid: { id: \"###\" }, $db: \"###\" }", "code" : 13, "codeName" : "Unauthorized" }) db.orders.update({a:1}, {$set: {"updated": true}}) WriteCommandError({ "ok" : 0, "errmsg" : "not authorized on products to execute command { update: \"###\", ordered: \"###\", lsid: { id: \"###\" }, $db: \"###\" }", "code" : 13, "codeName" : "Unauthorized" }) In the last example above, if either or both insert() or update() succeed, this is a finding. Note that this check is by necessity application-specific.

Fix: F-55582r813909_fix

Determine the organization-defined circumstances or situations that require reauthentication and ensure that the mongod and mongos processes are stopped/started (restart), and ensure that the mongod configuration file has security.authentication: true set. In the case of database- and collection-level scoped user privileges, see MongoDB documentation for guidance on application specific configuration for user privileges in order to restrict access as required: https://docs.mongodb.com/v4.4/tutorial/manage-users-and-roles/#create-a-role-to-manage-current-operations https://docs.mongodb.com/v4.4/core/collection-level-access-control/#privileges-and-scope

b
MongoDB must prohibit the use of cached authenticators after an organization-defined time period.
IA-5 - Medium - CCI-002007 - V-252177 - SV-252177r879773_rule
RMF Control
IA-5
Severity
Medium
CCI
CCI-002007
Version
MD4X-00-005700
Vuln IDs
  • V-252177
Rule IDs
  • SV-252177r879773_rule
If cached authentication information is out-of-date, the validity of the authentication information may be questionable.
Checks: C-55633r813911_chk

If MongoDB is configured to authenticate using SASL and LDAP check the saslauthd command line options in the system boot script that starts saslauthd (the location will be dependent on the specific Linux operating system and boot script layout and naming conventions). If the "-t" option is not set for the "saslauthd" process in the system boot script, this is a finding.

Fix: F-55583r813912_fix

With MongoDB configured using SASL LDAP authentication and on certain Linux distributions, saslauthd starts with the caching of authentication credentials enabled. Until restarted or until the cache expires, saslauthd will not contact the LDAP server to re-authenticate users in its authentication cache. This allows saslauthd to successfully authenticate users in its cache, even in the LDAP server is down or if the cached users' credentials are revoked. To set the expiration time (in seconds) for the authentication cache, see the -t option of saslauthd (https://www.systutorials.com/docs/linux/man/8-saslauthd/).

b
MongoDB must only accept end entity certificates issued by DoD PKI or DoD-approved PKI Certification Authorities (CAs) for the establishment of all encrypted sessions.
SC-23 - Medium - CCI-002470 - V-252178 - SV-252178r879798_rule
RMF Control
SC-23
Severity
Medium
CCI
CCI-002470
Version
MD4X-00-005800
Vuln IDs
  • V-252178
Rule IDs
  • SV-252178r879798_rule
Only DoD-approved external PKIs have been evaluated to ensure that they have security controls and identity vetting procedures in place which are sufficient for DoD systems to rely on the identity asserted in the certificate. PKIs lacking sufficient security controls and identity vetting procedures risk being compromised and issuing certificates that enable adversaries to impersonate legitimate users. The authoritative list of DoD-approved PKIs is published at https://cyber.mil/pki-pke/. This requirement focuses on communications protection for MongoDB session rather than for the network packet.
Checks: C-55634r813914_chk

To run MongoDB in TLS mode, obtain a valid certificate singed by a single certificate authority. Before starting the MongoDB database in TLS mode, verify that certificate used is issued by a valid DoD certificate authority (openssl x509 -in path_to_certificate_pem_file -text | grep -i issuer). If there is any issuer present in the certificate that is not a DoD approved certificate authority, this is a finding.

Fix: F-55584r817014_fix

Remove any certificate 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 authority.

b
MongoDB must maintain the confidentiality and integrity of information during preparation for transmission.
SC-8 - Medium - CCI-002420 - V-252179 - SV-252179r879812_rule
RMF Control
SC-8
Severity
Medium
CCI
CCI-002420
Version
MD4X-00-006000
Vuln IDs
  • V-252179
Rule IDs
  • SV-252179r879812_rule
Information can be either unintentionally or maliciously disclosed or modified during preparation for transmission, including, for example, during aggregation, at protocol transformation points, and during packing/unpacking. These unauthorized disclosures or modifications compromise the confidentiality or integrity of the information. Use of this requirement will be limited to situations where the data owner has a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process. When transmitting data, MongoDB, associated applications, and infrastructure must leverage transmission protection mechanisms.
Checks: C-55635r813917_chk

Review the system information/specification for information indicating a strict requirement for data integrity and confidentiality when data is being prepared to be transmitted. If such information is absent therein, this is not a finding. If such information is present, inspect the MongoDB configuration file (default location: /etc/mongod.conf) for the following entries: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem allowInvalidCertificates: false allowConnectionsWithoutCertificates: false FIPSMode: true If net.tls.mode is not set to requireTLS, this is a finding.

Fix: F-55585r813918_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% with TLS configuration options such as: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem allowInvalidCertificates: false allowConnectionsWithoutCertificates: false FIPSMode: true Set net.tls.mode to the requireTLS. Set net.tls.certificateKeyFile to the full path of the certificate (.pem) file. Start/stop (restart) all mongod or mongos instances using the %MongoDB configuration file% (default location: /etc/mongod.conf).

b
MongoDB must maintain the confidentiality and integrity of information during reception.
SC-8 - Medium - CCI-002422 - V-252180 - SV-252180r879813_rule
RMF Control
SC-8
Severity
Medium
CCI
CCI-002422
Version
MD4X-00-006100
Vuln IDs
  • V-252180
Rule IDs
  • SV-252180r879813_rule
Information can be either unintentionally or maliciously disclosed or modified during reception, including, for example, during aggregation, at protocol transformation points, and during packing/unpacking. These unauthorized disclosures or modifications compromise the confidentiality or integrity of the information. This requirement applies only to those applications that are either distributed or can allow access to data nonlocally. Use of this requirement will be limited to situations where the data owner has a strict requirement for ensuring data integrity and confidentiality is maintained at every step of the data transfer and handling process. When receiving data, MongoDB, associated applications, and infrastructure must leverage protection mechanisms.
Checks: C-55636r813920_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 information is present, inspect the MongoDB configuration file (default location: /etc/mongod.conf) for the following entries: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem allowInvalidCertificates: false allowConnectionsWithoutCertificates: false FIPSMode: true If net.tls.mode is not set to requireTLS, this is a finding.

Fix: F-55586r813921_fix

Obtain a certificate from a valid DoD certificate authority to be used for encrypted data transmission. Modify the %MongoDB configuration file% with TLS configuration options such as: net: tls: mode: requireTLS certificateKeyFile: /etc/ssl/mongodb.pem CAFile: /etc/ssl/caToValidateClientCertificates.pem allowInvalidCertificates: false allowConnectionsWithoutCertificates: false FIPSMode: true Ensue net.tls.mode is set to requireTLS. Start/stop (restart) all mongod or mongos instances using the %MongoDB configuration file% (default location: /etc/mongod.conf).

b
When invalid inputs are received, MongoDB must behave in a predictable and documented manner that reflects organizational and system objectives.
SI-10 - Medium - CCI-002754 - V-252181 - SV-252181r879818_rule
RMF Control
SI-10
Severity
Medium
CCI
CCI-002754
Version
MD4X-00-006200
Vuln IDs
  • V-252181
Rule IDs
  • SV-252181r879818_rule
A common vulnerability is unplanned behavior when invalid inputs are received. This requirement guards against adverse or unintended system behavior caused by invalid inputs, where information system responses to the invalid input may be disruptive or cause the system to fail into an unsafe state. The behavior will be derived from the organizational and system requirements and includes, but is not limited to, notification of the appropriate personnel, creating an audit record, and rejecting invalid input. This calls for inspection of application source code, which will require collaboration with the application developers. It is recognized that in many cases, the database administrator (DBA) is organizationally separate from the application developers, and may have limited, if any, access to source code. Nevertheless, protections of this type are so important to the secure operation of databases that they must not be ignored. At a minimum, the DBA must attempt to obtain assurances from the development organization that this issue has been addressed, and must document what has been discovered.
Checks: C-55637r855522_chk

This is application-specific, but see Schema Validation documentation here: https://docs.mongodb.com/v4.4/core/schema-validation/ As an example, as a user with the dbAdminAnyDatabase role, execute the following on the database of interest: use database db.getCollectionInfos() Where database is the name of the database on which validator rules are to be inspected. This returns an array of documents containing all collections information within the database. For all collections information received, check if the options sub-document contains a validator. If the options sub-document does not contain a validator, this is a finding. Example below shows a finding: [ { "name" : "inventory", "type" : "collection", "options" : { }, "info" : { "readOnly" : false, "uuid" : UUID("b2c86d4d-48bf-4394-9743-620e6d68b87f") }, "idIndex" : { "v" : 2, "key" : { "_id" : 1 }, "name" : "_id_", "ns" : "products.inventory" } } ]

Fix: F-55587r813924_fix

Document validation can be added at the time of creation of a new collection. Existing collections can also be modified with document validation rules. Use the validator option to create or update a collection with the desired validation rules. See Schema Validation documentation for details: https://docs.mongodb.com/v4.4/core/schema-validation/

b
When updates are applied to MongoDB software, any software components that have been replaced or made unnecessary must be removed.
SI-2 - Medium - CCI-002617 - V-252182 - SV-252182r879825_rule
RMF Control
SI-2
Severity
Medium
CCI
CCI-002617
Version
MD4X-00-006300
Vuln IDs
  • V-252182
Rule IDs
  • SV-252182r879825_rule
Previous versions of DBMS components that are not removed from the information system after updates have been installed may be exploited by adversaries. Some DBMSs' installation tools may remove older versions of software automatically from the information system. In other cases, manual review and removal will be required. In planning installations and upgrades, organizations must include steps (automated, manual, or both) to identify and remove the outdated modules. A transition period may be necessary when both the old and the new software are required. This should be taken into account in the planning.
Checks: C-55638r813926_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-4.4.8-1.el7.x86_64 The output of the command above indicates that MongoDB Enterprise Server has been installed with a package manager. The preceding output is an example showing that MongoDB Enterprise Server Version 4.4.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), 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 Manager (YUM/RPM for RedHat), this is a finding.

Fix: F-55588r813927_fix

If there is a finding, then MongoDB has not been installed via a package manager and may have been installed manually or not at all. If MongoDB has not been installed via a package manager, verify that an organizational or site-specific document outlining the installation and upgrade procedures for software exists. 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: ./mongod --version db version v4.4.8 Build Info: { "version": "4.4.8", "gitVersion": "83b8bb8b6b325d8d8d3dfd2ad9f744bdad7d6ca0", "openSSLVersion": "OpenSSL 1.0.1e-fips 11 Feb 2013", "modules": [ "enterprise" ], "allocator": "tcmalloc", "environment": { "distmod": "rhel70", "distarch": "x86_64", "target_arch": "x86_64" } } Verify that the version desired (what the upgraded version should be) matches what is shown the in output. For example, if updated from MongoDB Enterprise Server v4.4.8 to v4.4.9, the output after the update would be similar to the above but the db version would reflect v4.4.9. 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

b
Security-relevant software updates to MongoDB must be installed within the time period directed by an authoritative source (e.g., IAVM, CTOs, DTMs, and STIGs).
SI-2 - Medium - CCI-002605 - V-252183 - SV-252183r879827_rule
RMF Control
SI-2
Severity
Medium
CCI
CCI-002605
Version
MD4X-00-006400
Vuln IDs
  • V-252183
Rule IDs
  • SV-252183r879827_rule
Security flaws with software applications, including database management systems, are discovered daily. Vendors are constantly updating and patching their products to address newly discovered security vulnerabilities. Organizations (including any contractor to the organization) are required to promptly install security-relevant software updates (e.g., patches, service packs, and hot fixes). Flaws discovered during security assessments, continuous monitoring, incident response activities, or information system error handling must also be addressed expeditiously. Organization-defined time periods for updating security-relevant software may vary based on a variety of factors including, for example, the security category of the information system or the criticality of the update (i.e., severity of the vulnerability related to the discovered flaw). This requirement will apply to software patch management solutions that are used to install patches across the enclave and also to applications themselves that are not part of that patch management solution. For example, many browsers today provide the capability to install their own patch software. Patch criticality, as well as system criticality, will vary. Therefore, the tactical situations regarding the patch management process will also vary. This means that the time period utilized must be a configurable parameter. Time frames for application of security-relevant software updates may be dependent upon the Information Assurance Vulnerability Management (IAVM) process. The application will be configured to check for and install security-relevant software updates within an identified time period from the availability of the update. The specific time period will be defined by an authoritative source (e.g., IAVM, CTOs, DTMs, and STIGs).
Checks: C-55639r855525_chk

Review the organizational or site-specific software update policy and verify that MongoDB has been updated consistent with the time frame specified by the policy. The current major version of MongoDB can be found here: https://docs.mongodb.com/v4.4/release-notes/ This link will show the major version of MongoDB. To find the minor version within that release select the appropriate sublink. For example, to see the latest 4.4 minor releases in MongoDB, select the Release Notes for 4.4. This will show all minor releases and their notes. For example: 4.4.9, 4.4.8, 4.4.6, 4.4.5, etc. If MongoDB has not been updated to the necessary major and minor release in accordance with the policy, this is a finding.

Fix: F-55589r813930_fix

Institute and adhere to the policies and procedures to ensure that MongoDB is updated 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.

c
MongoDB products must be a version supported by the vendor.
SA-22 - High - CCI-003376 - V-252184 - SV-252184r944388_rule
RMF Control
SA-22
Severity
High
CCI
CCI-003376
Version
MD4X-00-006500
Vuln IDs
  • V-252184
Rule IDs
  • SV-252184r944388_rule
Unsupported commercial and database systems should not be used because fixes to newly identified bugs will not be implemented by the vendor. The lack of support can result in potential vulnerabilities. Systems at unsupported servicing levels or releases will not receive security updates for new vulnerabilities, which leaves them subject to exploitation. When maintenance updates and patches are no longer available, the database software is no longer considered supported and should be upgraded or decommissioned.
Checks: C-55640r813932_chk

Review the system documentation and interview the database administrator. Identify all database software components. Review the version and release information. To determine the current running MongoDB server version, run the following command from the Mongo Shell: db.version() Access the MongoDB website (https://www.mongodb.com/support-policy/lifecycles) or use other means to verify if the currently running MongoDB server version is still supported. If the DBMS or any of the software components are not supported by MongoDB, this is a finding.

Fix: F-55590r813933_fix

Remove or decommission all unsupported software products. Upgrade unsupported DBMS or unsupported components to a supported version of the product.

b
MongoDB must be configured in accordance with the security configuration settings based on DoD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, DTMs, and IAVMs.
CM-6 - Medium - CCI-000366 - V-252185 - SV-252185r879887_rule
RMF Control
CM-6
Severity
Medium
CCI
CCI-000366
Version
MD4X-00-006600
Vuln IDs
  • V-252185
Rule IDs
  • SV-252185r879887_rule
Configuring MongoDB to implement organization-wide security implementation guides and security checklists ensures compliance with federal standards and establishes a common security baseline across DoD that reflects the most restrictive security posture consistent with operational requirements. In addition to this SRG, sources of guidance on security and information assurance exist. These include NSA configuration guides, CTOs, DTMs, and IAVMs. MongoDB must be configured in compliance with guidance from all such relevant sources.
Checks: C-55641r813935_chk

Assessing the system against the STIG configurations and guidance of the current document is the check for this requirement. If the MongoDB is not configured in accordance with the security configuration settings of this document, this is a finding.

Fix: F-55591r816998_fix

Configure MongoDB in accordance with security configuration settings and guidance of this STIG document to meet the configurations required by the STIG, NSA configuration guidelines, 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: https://docs.mongodb.com/v4.4/tutorial/install-mongodb-enterprise-on-red-hat/