{"stig":{"title":"MongoDB Enterprise Advanced 3.x Security Technical Implementation Guide","version":"2","release":"3"},"checks":[{"vulnId":"V-221158","ruleId":"SV-221158r960768_rule","severity":"high","ruleTitle":"MongoDB must integrate with an organization-level authentication/access mechanism providing account management and automation for all users, groups, roles, and any other principals.","description":"MongoDB must integrate with an organization-level authentication/access mechanism providing account management and automation for all users, groups, roles, and any other principals.","checkContent":"Verify that the MongoDB configuration file (default location: /etc/mongod.conf) contains the following:\n\nsecurity:\nauthorization: \"enabled\"\n\nIf this parameter is not present, this is a finding.","fixText":"Edit the MongoDB configuration file (default location: /etc/mongod.con) to include the following:\n\nsecurity:\nauthorization: \"enabled\"\n\nThis will enable SCRAM-SHA-1 authentication (default).\n\nInstruction on configuring the default authentication is provided here:\n\nhttps://docs.mongodb.com/v3.4/tutorial/enable-authentication/\n\nThe high-level steps described by the above will require the following:\n\n1. Start MongoDB without access control.\n2. Connect to the instance.\n3. Create the user administrator.\n4. Restart the MongoDB instance with access control.\n5. Connect and authenticate as the user administrator.\n6. Create additional users as needed for your deployment.","ccis":["CCI-000015"]},{"vulnId":"V-221159","ruleId":"SV-221159r960792_rule","severity":"high","ruleTitle":"MongoDB must enforce approved authorizations for logical access to information and system resources in accordance with applicable access control policies.","description":"MongoDB must enforce approved authorizations for logical access to information and system resources in accordance with applicable access control policies.","checkContent":"Review the system documentation to determine the required levels of protection for DBMS 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.\n\nMongoDB commands to view roles in a particular database:\n\ndb.getRoles(\n{\nrolesInfo: 1,\nshowPrivileges:true,\nshowBuiltinRoles: true\n}\n)","fixText":"Use createRole(), updateRole(), dropRole(), grantRole() statements to add and remove permissions on server-level securables, bringing them into line with the documented requirements.\n\nMongoDB commands for role management can be found here:\nhttps://docs.mongodb.com/v3.4/reference/method/js-role-management/","ccis":["CCI-000213"]},{"vulnId":"V-221160","ruleId":"SV-221160r960879_rule","severity":"medium","ruleTitle":"MongoDB must provide audit record generation for DoD-defined auditable events within all DBMS/database components.","description":"MongoDB must provide audit record generation capability for DoD-defined auditable events within all DBMS/database components.\n\nSatisfies: 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-000093-DB-000052, 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","checkContent":"Check the MongoDB configuration file (default location: '/etc/mongod.conf)' for a key named 'auditLog:'. \n\nExample shown below:\n\nauditLog:\ndestination: syslog\n\nIf an \"auditLog:\" key is not present, this is a finding indicating that auditing is not turned on.\n\nIf the \"auditLog:\" key is present and contains a subkey of \"filter:\" with an associated filter value string, this is a finding. \n\nThe 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.\n\nExample show below:\n\nauditLog:\ndestination: syslog\nfilter: '{ atype: { $in: [ \"createCollection\", \"dropCollection\" ] } }'","fixText":"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:\n\nauditLog:\ndestination: syslog\n\nStop/start (restart) the mongod or mongos instance using this configuration.\n\nIf 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.","ccis":["CCI-000130","CCI-000131","CCI-000132","CCI-000133","CCI-000134","CCI-000135","CCI-000140","CCI-000166","CCI-000171","CCI-000172","CCI-001462","CCI-001464","CCI-001487","CCI-001814","CCI-001844","CCI-001851","CCI-001858"]},{"vulnId":"V-221161","ruleId":"SV-221161r960930_rule","severity":"medium","ruleTitle":"The audit information produced by MongoDB must be protected from unauthorized read access.","description":"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.\n\nTo 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.\n\nThis 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.\n\nAdditionally, 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.\n\nAudit information includes all information (e.g., audit records, audit settings, and audit reports) needed to successfully audit information system activity.\n\nSatisfies: SRG-APP-000118-DB-000059, SRG-APP-000119-DB-000060, SRG-APP-000120-DB-000061","checkContent":"Verify User ownership, Group ownership, and permissions on the \"<MongoDB auditLog directory>\":\n\n> ls –ald <MongoDB auditLog data directory>\n\nIf the User owner is not \"mongod\", this is a finding.\n\nIf the Group owner is not \"mongod\", this is a finding.\n\nIf the directory is more permissive than \"700\", this is a finding.\n\n(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'.) \n\nTo find the auditLog directory name, view and search for the entry in the MongoDB configuration file for the auditLog.path:\n\nExample:\n\nauditLog:\ndestination: file\nformat: BSON\npath: /var/lib/mongo/auditLog.bson\n\nGiven the example above, to find the auditLog directory name run the following command:\n\n> dirname /var/lib/mongo/auditLog.bson\nthe output will be the \"<MongoDB auditLog directory>\"\n\n/var/lib/mongo","fixText":"Run these commands: \n\n\"chown mongod <MongoDB auditLog directory>\" \n\"chgrp mongod <MongoDB auditLog directory>\" \n\"chmod 700 <<MongoDB auditLog directory>\"\n\n(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'.) \n\nTo find the auditLog directory name, view and search for the entry in the MongoDB configuration file for the auditLog.path:\n\nExample:\n\nauditLog:\ndestination: file\nformat: BSON\npath: /var/lib/mongo/auditLog.bson\n\nGiven the example above, to find the auditLog directory name run the following command:\n\n> dirname /var/lib/mongo/auditLog.bson\nthe output will be the \"<MongoDB auditLog directory>\"\n\n/var/lib/mongo","ccis":["CCI-000162","CCI-000163","CCI-000164"]},{"vulnId":"V-221162","ruleId":"SV-221162r960939_rule","severity":"medium","ruleTitle":"MongoDB must protect its audit features from unauthorized access.","description":"Protecting audit data also includes identifying and protecting the tools used to view and manipulate log data.\n\nDepending 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.\n\nApplications 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.\n\nAudit 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.\n\nIf an attacker were to gain access to audit tools, he 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.\n\nSatisfies: SRG-APP-000121-DB-000202, SRG-APP-000122-DB-000203, SRG-APP-000122-DB-000204","checkContent":"Verify User ownership, Group ownership, and permissions on the “<MongoDB configuration file>\":\n\n(default name and location is '/etc/mongod.conf')\n\n(The name and location for the MongoDB configuration file will vary according to local circumstances.) \n\nUsing the default name and location the command would be:\n\n> ls –ald /etc/mongod.conf\n\nIf the User owner is not \"mongod\", this is a finding.\n\nIf the Group owner is not \"mongod\", this is a finding.\n\nIf the filename is more permissive than \"700\", this is a finding.","fixText":"Run these commands: \n\n\"chown mongod <MongoDB configuration file>\" \n\"chgrp mongod <MongoDB configuration file>\" \n\"chmod 700 <<MongoDB configuration file>\"\n\n(The name and location for the MongoDB configuration file will vary according to local circumstances. The default name and location is '/etc/mongod.conf'.) \n\nUsing the default name and location the commands would be:\n\n> chown mongod /etc/mongod.conf \n> chgrp mongod /etc/mongod.conf \n> chmod 700 /etc/mongod.conf","ccis":["CCI-001493","CCI-001494","CCI-001495"]},{"vulnId":"V-221163","ruleId":"SV-221163r960960_rule","severity":"high","ruleTitle":"MongoDB software installation account must be restricted to authorized users.","description":"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.\n\nIf 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.\n\nAccordingly, only qualified and authorized individuals must be allowed access to information system components for purposes of initiating changes, including upgrades and modifications.\n\nDBA 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.","checkContent":"Review procedures for controlling, granting access to, and tracking use of the DBMS software installation account.\n\nIf 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.","fixText":"Develop, document, and implement procedures to restrict and track use of the DBMS software installation account.","ccis":["CCI-001499"]},{"vulnId":"V-221164","ruleId":"SV-221164r960960_rule","severity":"medium","ruleTitle":"Database software, including DBMS configuration files, must be stored in dedicated directories, or DASD pools, separate from the host OS and other applications.","description":"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.\n\nMultiple 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.","checkContent":"Review the MongoDB software library directory and note other root directories located on the same disk directory or any subdirectories.\n\nIf any non-MongoDB software directories exist on the disk directory, examine or investigate their use. If any of the directories are used by other applications, including third-party applications that use the MongoDB this is a finding.\n\nOnly applications that are required for the functioning and administration, not use, of the MongoDB should be located in the same disk directory as the MongoDB software libraries.\n\nIf other applications are located in the same directory as the MongoDB database this is a finding.","fixText":"Install all applications on directories separate from the MongoDB software library directory. Relocate any directories or reinstall other application software that currently shares the MongoDB software library directory.","ccis":["CCI-001499"]},{"vulnId":"V-221165","ruleId":"SV-221165r960960_rule","severity":"medium","ruleTitle":"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.","description":"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.\n\nAccordingly, only qualified and authorized individuals must be allowed to obtain access to information system components for purposes of initiating changes, including upgrades and modifications.\n\nUnmanaged changes that occur to the database software libraries or configuration can lead to unauthorized or compromised installations.","checkContent":"Run the following command to get the roles from a MongoDB database.\n\nFor each database in MongoDB:\n\nuse <database>\ndb.getRoles(\n{\nrolesInfo: 1,\nshowPrivileges:true,\nshowBuiltinRoles: true\n}\n)\n\nRun the following command to the roles assigned to users:\n\nuse admin\ndb.system.users.find()\n\nAnalyze the output and if any roles or users have unauthorized access, this is a finding.","fixText":"Use the following commands to remove unauthorized access to a MongoDB database.\n\ndb.revokePrivilegesFromRole()\ndb. revokeRolesFromUser()\n\nMongoDB commands for role management can be found here:\nhttps://docs.mongodb.com/v3.4/reference/method/js-role-management/","ccis":["CCI-001499"]},{"vulnId":"V-221166","ruleId":"SV-221166r960963_rule","severity":"medium","ruleTitle":"Unused database components, DBMS software, and database objects must be removed.","description":"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).\n\nIt is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives.\n\nDBMSs must adhere to the principles of least functionality by providing only essential capabilities.","checkContent":"Review the list of components and features installed with the MongoDB database. \n\nIf unused components are installed and are not documented and authorized, this is a finding. \n\nRPM can also be used to check to see what is installed: \n\nyum list installed | grep mongodb\n\nThis returns MongoDB database packages that have been installed. \n\nIf any packages displayed by this command are not being used, this is a finding.","fixText":"On data-bearing nodes and arbiter nodes, the mongodb-enterprise-tools, mongodb-enterprise-shell and mongodb-enterprise-mongos can be removed (or not installed).\n\nOn applications servers that typically run the mongos process when connecting to a shared cluster, the only package required is the mongodb-enterprise-mongos package.","ccis":["CCI-000381"]},{"vulnId":"V-221167","ruleId":"SV-221167r960963_rule","severity":"medium","ruleTitle":"Unused database components that are integrated in MongoDB and cannot be uninstalled must be disabled.","description":"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).\n\nIt is detrimental for software products to provide, or install by default, functionality exceeding requirements or mission objectives.\n\nDBMSs must adhere to the principles of least functionality by providing only essential capabilities.\n\nUnused, 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.\n\nSatisfies: SRG-APP-000141-DB-000092, SRG-APP-000142-DB-000094","checkContent":"In the MongoDB database configuration file (default location: /etc/mongod.conf), review the following parameters:\n\nnet:\nhttp:\nenabled: true\nJSONPEnabled: true\nRESTInterfaceEnabled: true\n\nIf any of the <booleans> are \"True\" or \"Enabled\", this is a finding.","fixText":"In the MongoDB database configuration file (default location: /etc/mongod.conf), ensure the following parameters either:\n\nDoes not exist in the file\nOR\nAre set to \"false\" as shown below:\n\nhttp:\nenabled: false\nJSONPEnabled: false\nRESTInterfaceEnabled: false","ccis":["CCI-000381","CCI-000382"]},{"vulnId":"V-221168","ruleId":"SV-221168r960969_rule","severity":"medium","ruleTitle":"MongoDB must uniquely identify and authenticate organizational users (or processes acting on behalf of organizational users).","description":"To assure accountability and prevent unauthenticated access, organizational users must be identified and authenticated to prevent potential misuse and compromise of the system.\n\nOrganizational 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:\n\n(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\n(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.","checkContent":"To view another user’s information, you must have the \"viewUser\" action on the other user’s database.\n\nFor each database in the system, run the following command:\n\ndb.getUsers()\n\nEnsure each user identified is a member of an appropriate organization that can access the database.\n\nIf a user is found not be a member or an appropriate organization that can access the database, this is a finding.\n\nVerify that the MongoDB configuration file (default location: /etc/mongod.conf) contains the following:\n\nsecurity:\nauthorization: \"enabled\"\n\nIf this parameter is not present, this is a finding.","fixText":"Prereq: To drop a user from a database, must have the \"dropUser\" action on the database.\n\nFor any user not a member of an appropriate organization and has access to a database in the system run the following command:\n\n// Change to the appropriate database\nuse <database>\ndb.dropUser(<username>, {w: \"majority\", wtimeout: 5000}\n\nIf the MongoDB configuration file (default location: /etc/mongod.conf) does not contain\n\nsecurity: authorization: \"enabled\"\n\nEdit the MongoDB configuration file, add these parameters, stop/start (restart) any mongod or mongos process using this MongoDB configuration file.","ccis":["CCI-000764"]},{"vulnId":"V-221169","ruleId":"SV-221169r981946_rule","severity":"high","ruleTitle":"If DBMS authentication using passwords is employed, MongoDB must enforce the DoD standards for password complexity and lifetime.","description":"OS/enterprise authentication and identification must be used (SQL2-00-023600). Built-in DBMS authentication may be used only when circumstances make it unavoidable and must be documented and AO-approved.\n\nThe 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.\n\nIn 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.","checkContent":"If MongoDB is using Native LDAP authentication where the LDAP server is configured to enforce password complexity and lifetime, this is not a finding.\n\nIf MongoDB is using Kerberos authentication where Kerberos is configured to enforce password complexity and lifetime, this is not a finding.\n\nIf MongoDB is configured for SCRAM-SHA1, MONGODB-CR, LDAP Proxy authentication, this is a finding.\n\nSee: https://docs.mongodb.com/v3.4/core/authentication/#authentication-methods","fixText":"Either configure MongoDB for Native LDAP authentication where LDAP is configured to enforce password complexity and lifetime.\nOR\nConfigure MongoDB Kerberos authentication where Kerberos is configured to enforce password complexity and lifetime.","ccis":["CCI-000192"]},{"vulnId":"V-221170","ruleId":"SV-221170r981949_rule","severity":"high","ruleTitle":"If passwords are used for authentication, MongoDB must store only hashed, salted representations of passwords.","description":"The DoD standard for authentication is DoD-approved PKI certificates.\n\nAuthentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate, and requires AO approval.\n\nIn 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.","checkContent":"MongoDB supports x.509 certificate authentication for use with a secure TLS/SSL connection.\n\nThe x.509 client authentication allows clients to authenticate to servers with certificates rather than with a username and password.\n\nIf X.509 authentication is not used, a SCRAM-SHA-1 authentication protocol is also available. The SCRAM-SHA-1 protocol uses one-way, salted hash functions for passwords as documented here: https://docs.mongodb.com/v3.4/core/security-scram-sha-1/\n\nTo authenticate with a client certificate, you must first add a MongoDB user that corresponds to the client certificate. See Add x.509 Certificate subject as a User as documented here: https://docs.mongodb.com/v3.4/tutorial/configure-x509-client-authentication/\n\nTo authenticate, use the db.auth() method in the $external database, specifying \"MONGODB-X509\" for the mechanism field, and the user that corresponds to the client certificate for the user field.\n\nIf the mechanism field is not set to \"MONGODB-X509\", this is a finding.","fixText":"Do the following:\n- Create local CA and signing keys. \n- Generate and sign server certificates for member authentication. \n- Generate and sign client certificates for client authentication. \n- Start MongoDB cluster in non-auth mode. \n- Set up replica set and initial users. \n- Restart MongoDB replica set in X.509 mode using server certificates. \n\nExample shown here for x.509 Authentication: https://www.mongodb.com/blog/post/secure-mongodb-with-x-509-authentication\n\nAdditionally, SSL/TLS must be on as documented here: https://docs.mongodb.com/v3.4/tutorial/configure-ssl/","ccis":["CCI-000196"]},{"vulnId":"V-221171","ruleId":"SV-221171r961029_rule","severity":"high","ruleTitle":"If passwords are used for authentication, MongoDB must transmit only encrypted representations of passwords.","description":"The DoD standard for authentication is DoD-approved PKI certificates.\n\nAuthentication based on User ID and Password may be used only when it is not possible to employ a PKI certificate, and requires AO approval.\n\nIn such cases, passwords need to be protected at all times and encryption is the standard method for protecting passwords during transmission.\n\nDBMS 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.\n\nSatisfies: SRG-APP-000172-DB-000075, SRG-APP-000175-DB-000067","checkContent":"In the MongoDB database configuration file (default location: /etc/mongod.conf), review the following parameters:\n\nnet:\nssl:\nmode: requireSSL\nPEMKeyFile: /etc/ssl/mongodb.pem\nCAFile: /etc/ssl/mongodbca.pem\n\nIf the \"CAFile\" parameter is not present, this is a finding.\n\nIf the \"allowInvalidCertificates\" parameter is found, this is a finding.\n\nnet:\nssl:\nallowInvalidCertificates: true","fixText":"In the MongoDB database configuration file (default location: /etc/mongod.conf) ensure the following parameters are set and configured correctly:\n\nnet:\nssl:\nmode: requireSSL\nPEMKeyFile: /etc/ssl/mongodb.pem\nCAFile: /etc/ssl/mongodbca.pem\n\nRemove any occurrence of the \"allowInvalidCertificates\" parameter:\n\nnet:\nssl:\nallowInvalidCertificates: true\n\nStop/start (restart) the mongod or mongos instance using this configuration.","ccis":["CCI-000185","CCI-000197"]},{"vulnId":"V-221172","ruleId":"SV-221172r961041_rule","severity":"high","ruleTitle":"MongoDB must enforce authorized access to all PKI private keys stored/utilized by MongoDB.","description":"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.\n\nIf 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.\n\nBoth 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 validated cryptographic modules.\n\nAll 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.","checkContent":"In the MongoDB database configuration file (default location: /etc/mongod.conf), review the following parameters:\n\nnet:\nssl:\nmode: requireSSL\nPEMKeyFile: /etc/ssl/mongodb.pem\nCAFile: /etc/ssl/mongodbca.pem\n\nVerify ownership, group ownership, and permissions on the file given for PEMKeyFile (default 'mongodb.pem').\n\nRun following command and review its output:\nls -al /etc/mongod.conf\n\ntypical output:\n-rw------- 1 mongod mongod 566 Apr 26 20:20 /etc/mongod.conf\n\nIf the user owner is not \"mongod\", this is a finding.\n\nIf the group owner is not \"mongod\", this is a finding.\n\nIf the file is more permissive than \"600\", this is a finding.\n\nVerify ownership, group ownership, and permissions on the file given for CAFile (default 'ca.pem').\n\nIf the user owner is not \"mongod\", this is a finding.\n\nIf the group owner is not \"mongod\", this is a finding.\n\nIf the file is more permissive than \"600\", this is a finding.","fixText":"Run these commands:\n\"chown mongod:mongod /etc/ssl/mongodb.pem\"\n\"chmod 600 /etc/ssl/mongodb.pem\"\n\"chown mongod:mongod /etc/ssl/mongodbca.pem\"\n\"chmod 600 /etc/ssl/mongodbca.pem\"","ccis":["CCI-000186"]},{"vulnId":"V-221173","ruleId":"SV-221173r961044_rule","severity":"medium","ruleTitle":"MongoDB must map the PKI-authenticated identity to an associated user account.","description":"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.","checkContent":"To authenticate with a client certificate, you must first add the value of the subject from the client certificate as a MongoDB user. \n\nEach unique x.509 client certificate corresponds to a single MongoDB user; i.e. you cannot use a single client certificate to authenticate more than one MongoDB user.\n\nLogin to MongoDB and run the following command:\n\nuse $external\ndb.getUsers()\n\nIf the output does not contain a Relative Distinguished Name (RDN) for an authorized user, this is a finding.\n\nIf the output shows a Relative Distinguished Name (RDN) for users that are not authorized, this is a finding.","fixText":"Add x.509 Certificate subject as an authorized user.\n\nTo authenticate with a client certificate, you must first add the value of the subject from the client certificate as a MongoDB user. \n\nEach unique x.509 client certificate corresponds to a single MongoDB user; i.e. you cannot use a single client certificate to authenticate more than one MongoDB user.\n\nNote: The RDNs in the subject string must be compatible with the RFC2253 standard.\n\nRetrieve the RFC2253 formatted subject from the client certificate with the following command:\nopenssl x509 -in <pathToClient PEM> -inform PEM -subject -nameopt RFC2253\n\nThe command returns the subject string as well as certificate:\nsubject= CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry\n-----BEGIN CERTIFICATE-----\n# ...\n-----END CERTIFICATE-----\n\nAdd the RFC2253 compliant value of the subject as a user. Omit spaces as needed.\n\nFor 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:\ndb.getSiblingDB(\"$external\").runCommand(\n{\ncreateUser: \"CN=myName,OU=myOrgUnit,O=myOrg,L=myLocality,ST=myState,C=myCountry\",\nroles: [\n{ role: 'readWrite', db: 'test' },\n{ role: 'userAdminAnyDatabase', db: 'admin' }\n],\nwriteConcern: { w: \"majority\" , wtimeout: 5000 }\n}\n)\n\nIn 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.\n\nNote: 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.\n\nTo remove a user that is not authorized run the following command:\n\nuse $external\ndb.dropUser(\"<RDN of user>\")","ccis":["CCI-000187"]},{"vulnId":"V-221174","ruleId":"SV-221174r961050_rule","severity":"high","ruleTitle":"MongoDB must use NIST FIPS 140-2-validated cryptographic modules for cryptographic operations.","description":"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.\n\nApplications, including DBMSs, utilizing cryptography are required to use approved NIST FIPS 140-2-validated cryptographic modules that meet the requirements of applicable federal laws, Executive Orders, directives, policies, regulations, standards, and guidance.\n\nThe security functions validated as part of FIPS 140-2 for cryptographic modules are described in FIPS 140-2 Annex A.\n\nNSA Type-X (where X=1, 2, 3, 4) products are NSA-certified, hardware-based encryption modules.\n\nSatisfies: SRG-APP-000179-DB-000114, SRG-APP-000514-DB-000381, SRG-APP-000514-DB-000382, SRG-APP-000514-DB-000383, SRG-APP-000416-DB-000380","checkContent":"If MongoDB is deployed in a classified environment:\n\nIn the MongoDB database configuration file (default location: /etc/mongod.conf), search for and review the following parameters:\n\nnet:\nssl:\nFIPSMode: true\n\nIf this parameter is not present in the configuration file, this is a finding.\n\nIf \"FIPSMode\" is set to \"false\", this is a finding.\n\nCheck the server log file for a message that FIPS is active:\nSearch the log for the following text \"\"FIPS 140-2 mode activated\"\".\n\nIf this text is not found, this is a finding.\n\nVerify that FIPS has been enabled at the operating system. The following will return \"1\" if FIPS is enabled:\ncat /proc/sys/crypto/fips_enabled\n\nIf the above command does not return \"1\", this is a finding.","fixText":"Enable FIPS 140-2 mode for MongoDB Enterprise.\n\nEdit the MongoDB database configuration file (default location: /etc/mongod.conf) to contain the following parameter setting:\n\nnet:\nssl:\nFIPSMode: true\n\nStop/start (restart) the mongod or mongos instance using this configuration.\n\nFor the operating system finding, please refer to the appropriate operating system documentation for the procedure to install, configure, and test FIPS mode.","ccis":["CCI-000803","CCI-002450"]},{"vulnId":"V-221175","ruleId":"SV-221175r961053_rule","severity":"medium","ruleTitle":"MongoDB must uniquely identify and authenticate non-organizational users (or processes acting on behalf of non-organizational users).","description":"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).\n\nNon-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.\n\nAccordingly, a risk assessment is used in determining the authentication needs of the organization.\n\nScalability, 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.\n\nSatisfies: SRG-APP-000180-DB-000115, SRG-APP-000211-DB-000122, SRG-APP-000211-DB-000124","checkContent":"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. You can additionally create user-defined roles. \n\nCheck a user's role to ensure correct privileges for the function:\n\nPrereq: To view a user's roles, you must have the \"viewUser\" privilege. \n\nConnect to MongoDB.\n\nFor each database in the system, identify the user's roles for the database:\n\nuse <database>\ndb.getUser(\"[username]\")\n\nThe server will return a document with the user's roles.\n\nView a role's privileges:\n\nPrereq: To view a user's roles, you must have the \"viewUser\" privilege. \n\nFor each database, identify the privileges granted by a role:\n\nuse <database>\ndb.getRole( \"read\", { showPrivileges: true } )\n\nThe 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.\n\nIf a user has a role with inappropriate privileges, this is a finding.","fixText":"Prereq: To view a user's roles, must have the \"viewUser\" privilege. \n\nConnect to MongoDB.\n\nFor each database, identify the user's roles for the database. \n\nuse <database>\ndb.getUser(\"[username]\")\n\nThe server will return a document with the user's roles.\n\nTo revoke a user's role from a database use the db.revokeRolesFromUser() method.\n\nTo grant a role to a user use the db.grantRolesToUser() method.","ccis":["CCI-000804","CCI-001082","CCI-001084"]},{"vulnId":"V-221176","ruleId":"SV-221176r961119_rule","severity":"medium","ruleTitle":"MongoDB must maintain the authenticity of communications sessions by guarding against man-in-the-middle attacks that guess at Session ID values.","description":"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.\n\nThe preferred technique for thwarting guesses at Session IDs is the generation of unique session identifiers using a FIPS 140-2 approved random number generator.\n\nHowever, 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.","checkContent":"Check the MongoDB configuration file (default location: /etc/mongod.conf).\n\nThe following should be set:\n\nnet:\nssl:\nmode: requireSSL\n\nIf this is not found in the MongoDB configuration file, this is a finding.","fixText":"Follow the documentation guide at https://docs.mongodb.com/v3.4/tutorial/configure-ssl/.\n\nStop/start (restart) and mongod or mongos using the MongoDB configuration file.","ccis":["CCI-001188"]},{"vulnId":"V-221177","ruleId":"SV-221177r961122_rule","severity":"medium","ruleTitle":"MongoDB must fail to a secure state if system initialization fails, shutdown fails, or aborts fail.","description":"Failure to a known state can address safety or security in accordance with the mission/business needs of the organization.\n\nFailure 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.\n\nFailure 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.\n\nDatabases must fail to a known consistent state. Transactions must be successfully completed or rolled back.\n\nIn 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.\n\nAbort refers to stopping a program or function before it has finished naturally. The term abort refers to both requested and unexpected terminations.\n\nSatisfies: SRG-APP-000225-DB-000153, SRG-APP-000226-DB-000147","checkContent":"Journaling is enabled by default in 64-bit systems.\n\nWith journaling enabled, if mongod stops unexpectedly, the program can recover everything written to the journal. \n\nMongoDB will re-apply the write operations on restart and maintain a consistent state. By default, the greatest extent of lost writes, i.e., those not made to the journal, are those made in the last 100 milliseconds, plus the time it takes to perform the actual journal writes. \n\nVerify the mongod process startup options.\n\nIf the mongod process was started with the \"--nojournal\" option, this is a finding.","fixText":"Modify the mongod startup command-line options by removing the \"--nojournal\" option.\n\nEdit the MongoDB database configuration file (default location: /etc/mongod.conf) to ensure it contains the following parameter setting:\n\nstorage:\njournal:\nenabled: true\n\nStop/start (restart) any or all mongod processes.","ccis":["CCI-001190","CCI-001665"]},{"vulnId":"V-221178","ruleId":"SV-221178r961128_rule","severity":"high","ruleTitle":"MongoDB must protect the confidentiality and integrity of all information at rest.","description":"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.\n\nUser 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.\n\nIf the confidentiality and integrity of application data is not protected, the data will be open to compromise and unauthorized modification.","checkContent":"If the MongoDB Encrypted Storage Engines is being used, ensure that the \"security.enableEncryption\" option is set to \"true\" in the MongoDB configuration file (default location: /etc/mongod.conf) or that MongoDB was started with the \"--enableEncryption\" command line option.\n\nCheck the MongoDB configuration file (default location: /etc/mongod.conf).\n\nIf the following parameter is not present, this is a finding.\n\nsecurity:\nenableEncryption: \"true\"\n\nIf any mongod process is started with \"--enableEncryption false\", this is a finding.","fixText":"Ensure that the MongoDB Configuration file (default location: /etc/mongod.conf) has the following set:\n\nsecurity:\nenableEncryption: \"true\"\n\nEnsure that any mongod process that contains the option \"--enableEcryption\" has \"true\" as its parameter <boolean> value (e.g., \"--enableEncryption true\").\n\nStop/start (restart) and mongod process using either the MongoDB configuration file or that contains the \"--enableEncryption\" option.","ccis":["CCI-001199"]},{"vulnId":"V-221179","ruleId":"SV-221179r961149_rule","severity":"medium","ruleTitle":"Database contents must be protected from unauthorized and unintended information transfer by enforcement of a data-transfer policy.","description":"Applications, including DBMSs, must prevent unauthorized and unintended information transfer via shared system resources.\n\nData 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.\n\nCopies of sensitive data must not be misplaced or left in a temporary location without the proper controls.","checkContent":"Review the procedures for the refreshing of development/test data from production.\n\nReview 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.\n\nVerify that copies of production data are not left in unprotected locations. \n\nIf 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.","fixText":"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.","ccis":["CCI-001090"]},{"vulnId":"V-221180","ruleId":"SV-221180r961149_rule","severity":"medium","ruleTitle":"MongoDB must prevent unauthorized and unintended information transfer via shared system resources.","description":"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.\n\nSatisfies: SRG-APP-000243-DB-000373, SRG-APP-000243-DB-000374","checkContent":"Verify the permissions for the following database files or directories:\n\nMongoDB default configuration file: \"/etc/mongod.conf\"\nMongoDB default data directory: \"/var/lib/mongo\"\n\nIf the owner and group are not both \"mongod\", this is a finding.\n\nIf the file permissions are more permissive than \"755\", this is a finding.","fixText":"Correct the permission to the files and/or directories that are in violation.\n\nMongoDB Configuration file (default location): \nchown mongod:mongod /etc/mongod.conf\nchmod 755 /etc/mongod.conf\n\nMongoDB data file directory (default location): \nchown -R mongod:mongod/var/lib/mongo\nchmod -R 755/var/lib/mongo","ccis":["CCI-001090"]},{"vulnId":"V-221181","ruleId":"SV-221181r961158_rule","severity":"medium","ruleTitle":"MongoDB must check the validity of all data inputs except those specifically identified by the organization.","description":"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.\n\nWith 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.\n\nEven 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.\n\nThis 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.","checkContent":"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. \n\nIf the \"security.javascriptEnabled\" option is set to \"true\" in the config file, this is a finding. \n\nStarting with MongoDB 3.2, database-level document validation can be configured for specific collections. Configured validation rules for the selected database can be viewed via the db.getSisterDB(\"database_name\").getCollectionInfos() command in mongo shell. \n\nIf validation is desired, but no rules are set, the valdiationAction is not \"error\" or the \"bypassDocumentValidation\" option is used for write commands on the application side, this is a finding.","fixText":"Disable the javascriptEnabled option in the config file.\n\nsecurity:\njavascriptEnabled: false\n\nIf document validation is needed, it should be configured according to the documentation page at https://docs.mongodb.com/manual/core/document-validation/.","ccis":["CCI-001310"]},{"vulnId":"V-221182","ruleId":"SV-221182r961158_rule","severity":"medium","ruleTitle":"MongoDB and associated applications must reserve the use of dynamic code execution for situations that require it.","description":"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.\n\nThe 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).\n\nThis 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.\n\nSatisfies: SRG-APP-000251-DB-000391, SRG-APP-000251-DB-000392","checkContent":"MongoDB operations permit arbitrary JavaScript expressions to be run directly on the server. \n\nIf 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. \n\nsecurity:\njavascriptEnabled: \"false\"","fixText":"Disable the \"javascriptEnabled\" option.\n\nEdit the MongoDB configuration file (default location: /etc/mongod.conf\" to include the following:\n\nsecurity:\njavascriptEnabled: false","ccis":["CCI-001310"]},{"vulnId":"V-221183","ruleId":"SV-221183r961167_rule","severity":"medium","ruleTitle":"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.","description":"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.\n\nDatabases 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.\n\nCarefully 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.\n\nThis 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.","checkContent":"Check custom database code to verify that error messages do not contain information beyond what is needed for troubleshooting the issue.\n\nIf custom database errors contain PII data, sensitive business data, or information useful for identifying the host system or database structure, this is a finding.\n\nWhen attempting to login with incorrect credentials, the user will receive an error message that the operation was unauthorized.\n\nIf a user is attempting to perform an operation for which they do not have privileges, the database will return an error message that the operation is not authorized.","fixText":"Configure custom database code and associated application code not to divulge sensitive information or information useful for system identification in error messages.","ccis":["CCI-001312"]},{"vulnId":"V-221184","ruleId":"SV-221184r961170_rule","severity":"medium","ruleTitle":"MongoDB must reveal detailed error messages only to the ISSO, ISSM, SA, and DBA.","description":"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.\n\nSome default DBMS error messages can contain information that could aid an attacker in, among others things, identifying the database type, host address, or state of the database. Custom errors may contain sensitive customer information.\n\nIt 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.\n\nAdministrative 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.\n\nThis 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.","checkContent":"A mongod or mongos running with \"security.redactClientLogData\" redacts any message accompanying a given log event before logging. \n\nThis 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.\n\nVerify that the MongoDB configuration file (default location: /etc/mongod.conf) contains the following:\n\nsecurity:\nredactClientLogData: \"true\"\n\nIf this parameter is not present, this is a finding.","fixText":"Edit the MongoDB configuration file (default location: /etc/mongod.conf) and add the following parameter \"redactClientLogData\" in the security section of that file:\n\nsecurity:\nredactClientLogData: \"true\"\n\nStop/start (restart) any mongod or mongos using the MongoDB configuration file.","ccis":["CCI-001314"]},{"vulnId":"V-221185","ruleId":"SV-221185r961269_rule","severity":"medium","ruleTitle":"MongoDB must associate organization-defined types of security labels having organization-defined security label values with information in storage.","description":"Without the association of security labels to information, there is no basis for MongoDB to make security-related access-control decisions.\n\nSecurity labels are abstractions representing the basic properties or characteristics of an entity (e.g., subjects and objects) with respect to safeguarding information.\n\nThese 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.\n\nOne example includes marking data as classified or FOUO. 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.\n\nThe mechanism used to support security labeling may be a feature of MongoDB product, a third-party product, or custom application code.\n\nSatisfies: SRG-APP-000311-DB-000308, SRG-APP-000313-DB-000309, SRG-APP-000313-DB-000310","checkContent":"MongoDB supports role-based access control at the collection level. If enabled, the database process should be started with \"security.authorization:enabled\" in the config file or with \"--auth\" in the command line.\n\nFor documents that have been labeled (e.g., {\"tag\" : \"classified\"}), read-only views can be created and secured via access privileges such that a user can only view those documents that have a specific tag or tags (e.g., user x can only view records that are labeled with the tag of classified). Existing views can be listed using the db.getCollectionInfos() command for the selected database in mongo shell. \n\nIf a view is not present for the collection requiring security labeling, this is a finding.\n\nMongoDB supports field-level redaction that allows the application to indicate to the database whether or not certain fields should be returned based on values in the field labels. \n\nIf desired and aggregation queries in the application code are not using the $redact stage with appropriate logic, this is a finding.","fixText":"Follow the documentation page to setup RBAC:https://docs.mongodb.com/manual/core/authorization/. \n\nFor the required collections, create specific read-only views that allow access to only a subset of the data in a collection as documented here: https://docs.mongodb.com/manual/core/views/. Permissions on the view are specified separately from the permissions on the underlying collection.\n\nUse the \"$redact\" operator to restrict the contents of the documents based on information stored in the documents themselves as documented here: https://docs.mongodb.com/master/reference/operator/aggregation/redact/","ccis":["CCI-002262","CCI-002263","CCI-002264"]},{"vulnId":"V-221186","ruleId":"SV-221186r961317_rule","severity":"medium","ruleTitle":"MongoDB must enforce discretionary access control policies, as defined by the data owner, over defined subjects and objects.","description":"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.\n\nWhen 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.\n\nA 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.\n\nThe policy is bounded 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.\n\nSatisfies: SRG-APP-000328-DB-000301, SRG-APP-000340-DB-000304","checkContent":"Review the system documentation to obtain the definition of the database/DBMS functionality considered privileged in the context of the system in question.\n\nIf any functionality considered privileged has access privileges granted to non-privileged users, this is a finding.","fixText":"Revoke any roles with unnecessary privileges to privileged functionality by executing the revoke command as documented here: \nhttps://docs.mongodb.com/v3.4/reference/method/db.revokeRolesFromUser/\n\nRevoke any unnecessary privileges from any roles by executing the revoke command as document here: \nhttps://docs.mongodb.com/v3.4/reference/method/db.revokePrivilegesFromRole/\n\nIf a new role with associated privileges needs to be created, follow the documentation here:\nhttps://docs.mongodb.com/v3.4/reference/command/createRole/","ccis":["CCI-002165","CCI-002235"]},{"vulnId":"V-221188","ruleId":"SV-221188r981952_rule","severity":"medium","ruleTitle":"MongoDB must utilize centralized management of the content captured in audit records generated by all components of MongoDB.","description":"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.\n\nThe 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.\n\nMongoDB 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.","checkContent":"MongoDB can be configured to write audit events to the syslog in Linux, but this is not available in Windows. Audit events can also be written to a file in either JSON on BSON format. Through the use of third-party tools or via syslog directly, audit records can be pushed to a centralized log management system.\n\nIf a centralized tool for log management is not installed and configured to collect audit logs or syslogs, this is a finding.","fixText":"Install a centralized syslog collecting tool and configured it as instructed in its documentation.\n\nTo enable auditing and print audit events to the syslog in JSON format, specify the syslog for the --auditDestination setting:\nmongod --dbpath data/db --auditDestination syslog\n\nAlternatively, these options can also be specified in the configuration file:\nstorage:\ndbPath: data/db\nauditLog:\ndestination: syslog","ccis":["CCI-001844"]},{"vulnId":"V-221189","ruleId":"SV-221189r961392_rule","severity":"medium","ruleTitle":"MongoDB must allocate audit record storage capacity in accordance with site audit record storage requirements.","description":"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.\n\nThe 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.\n\nIn 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.","checkContent":"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.  \n\nIf there have been incidents where MongoDB ran out of audit log space, this is a finding.\n\nA MongoDB audit log that is configured to be stored in a file is identified in the MongoDB configuration file (default: /etc/mongod.conf) under the \"auditLog:\" key and subkey \"destination:\" where \"destination\" is \"file\".  \n\nIf this is the case then the \"AuditLog:\" subkey \"path:\" determines where (device/directory) that file will be located.  \n\nView the mongodb configuration file (default location: /etc/mongod.conf) and identify how the \"auditlog.destination\" is configured.\n\nWhen the \"auditlog.destination\" is \"file\", this is a finding.","fixText":"View the mongodb configuration file (default location: /etc/mongod.conf) and view the \"auditlog.path\" to identify the storage volume.\n\nAllocate sufficient space to the storage volume hosting the file identified in the MongoDB configuration \"auditLog.path\" to support audit file peak demand.","ccis":["CCI-001849"]},{"vulnId":"V-221190","ruleId":"SV-221190r961398_rule","severity":"medium","ruleTitle":"MongoDB must provide a warning to appropriate support staff when allocated audit record storage volume reaches 75% of maximum audit record storage capacity.","description":"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.\n\nIf support personnel are not notified immediately upon storage volume utilization reaching 75%, they are unable to plan for storage capacity expansion.\n\nThe appropriate support staff include, at a minimum, the ISSO and the DBA/SA.","checkContent":"A MongoDB audit log that is configured to be stored in a file is identified in the MongoDB configuration file (default: /etc/mongod.conf) under the \"auditLog:\" key and subkey \"destination:\" where \"destination\" is \"file\".  \n\nIf this is the case then the \"AuditLog:\" subkey \"path:\" determines where (device/directory) that file will be located.  \n\nView the mongodb configuration file (default location: /etc/mongod.conf) and identify how the \"auditlog.destination\" is configured.\n\nWhen the \"auditlog.destination\" is \"file\", this is a finding.","fixText":"View the mongodb configuration file (default location: /etc/mongod.conf) and view the \"auditlog.path\" to identify the storage volume.\n\nInstall MongoDB Ops Manager or other organization approved monitoring software.\n\nConfigure the required alert in the monitoring software to send an alert where storage volume holding the auditLog file utilization reaches 75%.","ccis":["CCI-001855"]},{"vulnId":"V-221191","ruleId":"SV-221191r981956_rule","severity":"medium","ruleTitle":"MongoDB must prohibit user installation of logic modules (stored procedures, functions, triggers, views, etc.) without explicit privileged status.","description":"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.\n\nDBMS 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.\n\nMongoDB 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).\n\nIn the case of a database management system, this requirement covers stored procedures, functions, triggers, views, etc.","checkContent":"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. \n\nReview the MongoDB security settings with respect to non-administrative users' ability to create, alter, or replace functions or views.\n\nThese MongoDB commands can help with showing existing roles and permissions of users of the databases.\n\ndb.getRoles( { rolesInfo: 1, showPrivileges:true, showBuiltinRoles: true })\n\nIf any such permissions exist and are not documented and approved, this is a finding.","fixText":"Revoke any roles with unnecessary privileges to privileged functionality by executing the revoke command.\n\nRevoke any unnecessary privileges from any roles by executing the revoke command.\n\nCreate, as needed, new role(s) with associated privileges.","ccis":["CCI-001812"]},{"vulnId":"V-221192","ruleId":"SV-221192r961461_rule","severity":"medium","ruleTitle":"MongoDB must enforce access restrictions associated with changes to the configuration of MongoDB or database(s).","description":"Failure to provide logical access restrictions associated with changes to configuration may have significant effects on the overall security of the system.\n\nWhen 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.\n\nAccordingly, only qualified and authorized individuals should be allowed to obtain access to system components for the purposes of initiating changes, including upgrades and modifications.","checkContent":"Review the security configuration of the MongoDB database(s).\n\nIf unauthorized users can start the mongod or mongos processes or edit the MongoDB configuration file (default location: /etc/mongod.conf), this is a finding. \n\nIf MongoDB does not enforce access restrictions associated with changes to the configuration of the database(s), this is a finding.\n\nTo assist in conducting reviews of permissions, the following MongoDB commands describe permissions of databases and users: \n\nPermissions of concern in this respect include the following, and possibly others: \n- any user with a role of userAdminAnyDatabase role or userAdmin role \n- any database or with a user have a role or privilege with \"C\" (create) or \"w\" (update) privileges that are not necessary\n\nMongoDB commands to view roles in a particular database: \ndb.getRoles( { rolesInfo: 1, showPrivileges:true, showBuiltinRoles: true })","fixText":"Prereq: To view a user's roles, must have the \"viewUser\" privilege.\nhttps://docs.mongodb.com/v3.4/reference/privilege-actions/ \n\nConnect to MongoDB.\n\nFor each database, identify the user's roles for the database. \n\nuse <database> \ndb.getUser(\"[username]\") \n\nThe server will return a document with the user's roles. \n\nTo revoke a user's role from a database use the db.revokeRolesFromUser() method.\nhttps://docs.mongodb.com/v3.4/reference/method/db.revokeRolesFromUser/\n\nTo grant a role to a user use the db.grantRolesToUser() method. https://docs.mongodb.com/v3.4/reference/method/db.grantRolesToUser/","ccis":["CCI-001813"]},{"vulnId":"V-221193","ruleId":"SV-221193r987687_rule","severity":"medium","ruleTitle":"MongoDB must require users to reauthenticate when organization-defined circumstances or situations require reauthentication.","description":"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.\n\nWithout reauthentication, users may access resources or perform tasks for which they do not have authorization.\n\nWhen applications provide the capability to change security roles or escalate the functional capability of the application, it is critical the user reauthenticate.\n\nIn 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:\n\n(i) When authenticators change;\n(ii) When roles change;\n(iii) When security categories of information systems change;\n(iv) When the execution of privileged functions occurs;\n(v) After a fixed period of time; or\n(vi) Periodically.\n\nWithin the DoD, the minimum circumstances requiring reauthentication are privilege escalation and role changes.","checkContent":"If organization-defined circumstances or situations require reauthentication, and these situations are not configured to terminate existing logins to require reauthentication, this is a finding.","fixText":"Determine the organization-defined circumstances or situations that require reauthentication and ensure that the mongod and mongos processes are stopped/started (restart).","ccis":["CCI-002038"]},{"vulnId":"V-221194","ruleId":"SV-221194r961521_rule","severity":"medium","ruleTitle":"MongoDB must prohibit the use of cached authenticators after an organization-defined time period.","description":"If cached authentication information is out-of-date, the validity of the authentication information may be questionable.","checkContent":"If MongoDB is configured to authenticate using SASL and LDAP/Active Directory 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). \n\nIf the \"-t\" option is not set for the \"saslauthd\" process in the system boot script, this is a finding.\n\nIf any mongos process is running (a MongoDB shared cluster) the \"userCacheInvalidationIntervalSecs\" option can be used to specify the cache timeout.\n\nThe default is \"30\" seconds and the minimum is \"1\" second.","fixText":"If MongoDB is configured to authenticate using SASL and LDAP/Active Directory modify and restart the saslauthd command line options in the system boot script and set the \"-t\" option to the appropriate timeout in seconds.\n\nFrom the Linux Command line (with root/sudo privs) run the following command to restart the saslauthd process after making the change for the \"-t\" parameter:\n\nsystemctl restart saslauthd\n\nIf any mongos process is running (a MongoDB shared cluster) the \"userCacheInvalidationIntervalSecs\" option to adjust the timeout in seconds can be changed from the default \"30\" seconds. \n\nThis is accomplished by modifying the mongos configuration file (default location: /etc/mongos.conf) and then restarting mongos.","ccis":["CCI-002007"]},{"vulnId":"V-221195","ruleId":"SV-221195r961596_rule","severity":"medium","ruleTitle":"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.","description":"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.\n\nThe authoritative list of DoD-approved PKIs is published at http://iase.disa.mil/pki-pke/interoperability.\n\nThis requirement focuses on communications protection for MongoDB session rather than for the network packet.","checkContent":"To run MongoDB in SSL mode, you have to obtain a valid certificate singed by a single certificate authority. \n\nBefore starting the MongoDB database in SSL 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\"). \n\nIf there is any issuer present in the certificate that is not a DoD approved certificate authority, this is a finding.","fixText":"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 authorities.","ccis":["CCI-002470"]},{"vulnId":"V-221196","ruleId":"SV-221196r961599_rule","severity":"medium","ruleTitle":"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.","description":"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.\n\nSelection 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).\n\nThe 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.\n\nSatisfies: SRG-APP-000428-DB-000386, SRG-APP-000429-DB-000387","checkContent":"Review the documentation and/or specification for the organization-defined information. \n\nIf any data is PII, classified or is deemed by the organization to be encrypted at rest, this is a finding.\n\nVerify the mongod command line contain the following options:\n\n--enableEncryption \n--kmipServerName <KMIP Server HostName>\n--kmipPort <KMIP server port>\n--kmipServerCAFile ca.pem \n--kmipClientCertificateFile client.pem\n\nIf these above options are not part of the mongod command line, this is a finding.\n\nItems in the <> above and starting with kmip* are specific to the KMIP appliance and need to be set according to the KMIP appliance configuration.","fixText":"Configure MongoDB to use the Encrypted Storage Engine and a KMIP appliance as documented here:\n\nhttps://docs.mongodb.com/v3.4/core/security-encryption-at-rest/\nhttps://docs.mongodb.com/v3.4/tutorial/configure-encryption/","ccis":["CCI-002475"]},{"vulnId":"V-221197","ruleId":"SV-221197r961638_rule","severity":"medium","ruleTitle":"MongoDB must maintain the confidentiality and integrity of information during preparation for transmission.","description":"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.\n\nUse 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.\n\nWhen transmitting data, MongoDB, associated applications, and infrastructure must leverage transmission protection mechanisms.","checkContent":"Review the system information/specification for information indicating a strict requirement for data integrity and confidentiality when data is being prepared to be transmitted. \n\nIf such information is absent therein, this is not a finding. \n\nIf such information is present, inspect the MongoDB configuration file (default location: /etc/mongod.conf) for the following entries:\n\nnet:\nssl:\nmode: requireSSL\nPEMKeyFile: /etc/ssl/mongodb.pem\n\nIf net.ssl.mode is not set to \"requireSSL\", this is a finding.","fixText":"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 ssl configuration options such as:\n\nnet:\nssl:\nmode: requireSSL\nPEMKeyFile: /etc/ssl/mongodb.pem\n\nSet \"net.ssl.mode\" to the \"requireSSL\".\nSet \"net.ssl.KeyFile\" to the full path of the certificate (.pem) file.\n\nStart/stop (restart) all mongod or mongos instances using the MongoDB configuration file (default location: /etc/mongod.conf).","ccis":["CCI-002420"]},{"vulnId":"V-221198","ruleId":"SV-221198r961641_rule","severity":"medium","ruleTitle":"MongoDB must maintain the confidentiality and integrity of information during reception.","description":"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.\n\nThis 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.\n\nWhen receiving data, MongoDB, associated applications, and infrastructure must leverage protection mechanisms.","checkContent":"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.\n\nIf such strict requirement for ensure data integrity and confidentially is present, inspect the MongoDB configuration file (default location: /etc/mongod.conf) for the following entries:\n\nnet:\nssl:\nmode: requireSSL\nPEMKeyFile: /etc/ssl/mongodb.pem\n\nIf net.ssl.mode is not set to \"requireSSL\", this is a finding.","fixText":"Obtain a certificate from a valid DoD certificate authority to be used for encrypted data transmission. \n\nModify the MongoDB configuration file (default location: /etc/mongod.conf) with the network configuration options.\n\nnet:\nssl:\nmode: requireSSL\nPEMKeyFile: /etc/ssl/mongodb.pem\n\nSet \"net.ssl.mode\" to the \"requireSSL\".\nSet \"net.ssl.KeyFile\" to the full path of the certificate (.pem) file.\n\nStart/stop (restart) all mongod or mongos instances using the MongoDB configuration file (default location: /etc/mongod.conf).","ccis":["CCI-002422"]},{"vulnId":"V-221199","ruleId":"SV-221199r961656_rule","severity":"medium","ruleTitle":"When invalid inputs are received, MongoDB must behave in a predictable and documented manner that reflects organizational and system objectives.","description":"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.\n\nThe 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.\n\nThis 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.","checkContent":"As a user with the \"dbAdminAnyDatabase\" role, execute the following on the database of interest:\n\nuse myDB\ndb.getCollectionInfos()\n\nWhere \"myDB\" 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 myDB. For each collection's information received.\n\nIf the \"options\" sub-document within each does not contain a \"validator\" sub-document, this is a finding.","fixText":"Document validation can be added at the time of creation of a 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.","ccis":["CCI-002754"]},{"vulnId":"V-221200","ruleId":"SV-221200r961047_rule","severity":"high","ruleTitle":"MongoDB must obscure feedback of authentication information during the authentication process to protect the information from possible exploitation/use by unauthorized individuals.","description":"The DoD standard for authentication is DoD-approved PKI certificates.\n\nNormally, 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.\n\nTo 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.\n\nObfuscation of user-provided authentication secrets when typed into the system is a method used in addressing this risk.\n\nDisplaying asterisks when a user types in a password or a smart card PIN is an example of obscuring feedback of authentication secrets.\n\nThis 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.","checkContent":"For the MongoDB command-line tools \"mongo shell\", \"mongodump\", \"mongorestore\", \"mongoimport\", \"mongoexport\", which cannot be configured not to accept 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. \n\nIf it is not documented, this is a finding. \n\nRequest evidence that all users of these 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. \n\nIf evidence of training does not exist, this is a finding.","fixText":"For the \"mongo shell\", \"mongodump\", \"mongorestore\", \"mongoimport\", \"mongoexport\", which can accept a plain-text password, and any other essential tool with the same limitation: \n\nDocument the need for it, who uses it, and any relevant mitigations, and obtain AO approval. \n\nTrain 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.","ccis":["CCI-000206"]},{"vulnId":"V-221201","ruleId":"SV-221201r961863_rule","severity":"medium","ruleTitle":"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.","description":"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.\n\nIn 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.","checkContent":"Review the MongoDB documentation and configuration to determine it is configured in accordance with DoD security configuration and implementation guidance, including STIGs, NSA configuration guides, CTOs, DTMs, and IAVMs.\n\nIf the MongoDB is not configured in accordance with security configuration settings, this is a finding.","fixText":"Configure MongoDB in accordance with security configuration settings by reviewing the Operation System and MongoDB documentation and applying the necessary configuration parameters to meet the configurations required by the STIG, NSA configuration guidelines, CTOs, DTMs, and IAVMs.","ccis":["CCI-000366"]},{"vulnId":"V-265875","ruleId":"SV-265875r999531_rule","severity":"high","ruleTitle":"MongoDB products must be a version supported by the vendor.","description":"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.\n\nSystems at unsupported servicing levels or releases will not receive security updates for new vulnerabilities, which leaves them subject to exploitation.\n\nWhen maintenance updates and patches are no longer available, the database software is no longer considered supported and should be upgraded or decommissioned.","checkContent":"To determine the current running MongoDB server version, run the following command from the Mongo Shell:\n\ndb.version() \n\nMongoDB 3.x is no longer supported by the vendor. If the system is running MongoDB 3.x, this is a finding.","fixText":"Remove or decommission all unsupported software products.\n\nUpgrade unsupported DBMS or unsupported components to a supported version of the product.","ccis":["CCI-003376"]}]}