STIGQter STIGQter: STIG Summary: MongoDB Enterprise Advanced 8.x Security Technical Implementation Guide Version: 1 Release: 1 Benchmark Date: 26 Jan 2026:

MongoDB must terminate a user session after organization-defined conditions or trigger events requiring session disconnect via a scheduled script.

DISA Rule

SV-281700r1179499_rule

Vulnerability Number

V-281700

Group Title

SRG-APP-000295-DB-000305

Rule Version

MD8X-00-006050

Severity

CAT III

CCI(s)

Weight

10

Fix Recommendation

Determine the situations when a user-initiated database session must be terminated.

Note: The user running the commands shown below must have privileges with listSessions, killAnySession and impersonate action on the cluster.

In the MongoDB shell, as an authenticated user, run the following command to list all user sessions:

> use config
> db.system.sessions.aggregate( [ { $listSessions: { allUsers: true } }

Reference: https://docs.mongodb.com/v8.0/reference/operator/aggregation/listSessions/

Example output:

{ "_id" : { "id" : UUID("b3b50641-54c6-4d6d-a96e-a2239fadce3c"), "uid" : BinData(0,"Y5mrDaxi8gv8RmdTsQ+1j7fmkr7JUsabhNmXAheU0fg=") }, "lastUse" : ISODate("2021-09-23T23:34:43.951Z"), "user" : { "name" : "jsmith@admin" } }

From the output, identify the names of users whose sessions should be terminated. Using the user for each session to be terminated, run the following command (still in MongoDB shell):

> db.runCommand( { killAllSessionsByPattern: [ { users: [ { user: <user>, db: <dbname> }, ... ] }] } )

Example to terminate user "jsmith@admin" sessions from example output:

> db.runCommand( { killAllSessionsByPattern: [ { users: [ { user: "jsmith", db: "admin" } ] }]} )

To terminate all user sessions running on the database, run the following command (still in MongoDB shell):

> db.runCommand( { killAllSessionsByPattern: [ ] } )

Reference: https://docs.mongodb.com/v8.0/reference/command/killAllSessionsByPattern/

Check Contents

Review system documentation to obtain the organization's definition of circumstances requiring automatic session termination.

If the documentation explicitly states that such termination is not required or is prohibited, this is not a finding.

Ensure a script is in place and scheduled that does the following (see fix content for example commands):
1. Lists all user sessions.
2. From the output, determines which user-initiated database sessions must be terminated.
3. Terminates the identified sessions by user.

If a script does not exist or is not scheduled to run at least daily, this is a finding.

Vulnerability Number

V-281700

Documentable

False

Rule Version

MD8X-00-006050

Severity Override Guidance

Review system documentation to obtain the organization's definition of circumstances requiring automatic session termination.

If the documentation explicitly states that such termination is not required or is prohibited, this is not a finding.

Ensure a script is in place and scheduled that does the following (see fix content for example commands):
1. Lists all user sessions.
2. From the output, determines which user-initiated database sessions must be terminated.
3. Terminates the identified sessions by user.

If a script does not exist or is not scheduled to run at least daily, this is a finding.

Check Content Reference

M

Target Key

5728