SV-279365r1179467_rule
V-279365
SRG-APP-000251-DB-000160
MD8X-00-005500
CAT II
10
Disable the javascriptEnabled option in the MongoDB configuration file (default location /etc/mongod.conf) to include the following:
security:
javascriptEnabled: false
If document validation is needed, it must be configured according to the documentation page at:
https://www.mongodb.com/docs/v8.0/core/schema-validation/
As a client program assembles a query in MongoDB, it builds a BSON object, not a string. Thus, traditional SQL injection attacks are not a problem. However, MongoDB operations permit arbitrary JavaScript expressions to be run directly on the server.
To check, run the following command from the MongoDB shell:
> db.col.find({ $where: "return true;"} )
If the response does not return an error, this is a finding.
If javascript has been correctly disabled, the correct error would indicate that the javascript global engine has been disabled. For example:
MongoServerError: no globalScriptEngine in $where parsing}
V-279365
False
MD8X-00-005500
As a client program assembles a query in MongoDB, it builds a BSON object, not a string. Thus, traditional SQL injection attacks are not a problem. However, MongoDB operations permit arbitrary JavaScript expressions to be run directly on the server.
To check, run the following command from the MongoDB shell:
> db.col.find({ $where: "return true;"} )
If the response does not return an error, this is a finding.
If javascript has been correctly disabled, the correct error would indicate that the javascript global engine has been disabled. For example:
MongoServerError: no globalScriptEngine in $where parsing}
M
5728