Skip to content
CVE-2026-125120 CrowdStrike LogScale · LogScale

Detect Mongoose NoSQL Injection via Unsanitized countDocuments (CVE-2026-125120) in CrowdStrike LogScale

Detects potential exploitation and the vulnerable-condition footprint of CVE-2026-125120, a NoSQL injection (CWE-943) in the Mongoose ODM for MongoDB. The `sanitizeFilter` option, which strips attacker-supplied query operators (e.g. `$where`, `$gt`, `$ne`, `$regex`) from filter objects, was not applied to the `countDocuments()` code path. An application that enabled `sanitizeFilter` as a defense and passed user-controlled input into `Model.countDocuments(filter)` would still be injectable, allowing query-operator injection to bypass authentication checks, enumerate data via boolean/blind count oracles, or trigger server-side JavaScript evaluation. Affects mongoose < 6.13.11, 7.0.0-7.8.11, 8.0.0-8.24.2, and 9.0.0-9.9.1. Because exploitation occurs inside the Node.js process and is visible primarily as anomalous HTTP request bodies and MongoDB query shapes, detection correlates web/application logs (operator-laden JSON parameters) with MongoDB command logs (count operations containing injected operators) and inventory signals for vulnerable mongoose package versions.

MITRE ATT&CK

Tactic
Initial Access Collection Credential Access

LogScale Detection Query

CrowdStrike LogScale (LogScale)
cql
// df00tech DF00-5bf92bc4d1 · https://df00tech.com/detections/CVE-2026-125120 · licence: https://df00tech.com/detections/licence
#event_simpleName=/HttpRequest|AppProxyRequest/
| RequestBody := coalesce([RequestBody, HttpBody, UrlQuery])
| regex("(?i)(\\$where|\\$ne|\\$gt|\\$gte|\\$lt|\\$regex|\\$function|\\$expr|\\$accumulator)", field=RequestBody)
| groupBy([aid, RemoteAddressIP4], function=[count(as=hits), collect([RequestBody], limit=5)])
| hits >= 3
high severity medium confidence

CrowdStrike LogScale query flagging HTTP request bodies or query strings containing MongoDB operators, surfacing NoSQL-injection attempts against hosts running vulnerable Mongoose versions.

Data Sources

Falcon LogScale HTTP TelemetryApplication Proxy Logs

Required Tables

HttpRequestAppProxyRequest

False Positives & Tuning

  • Operator-accepting application filters.
  • Authorized DAST/scanner activity.
  • Internal test harness traffic.

Other platforms for CVE-2026-125120


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 Operator injection into count endpoint via JSON body

    Expected signal: Web/app access log entry with request body containing the $ne operator and a MongoDB count command log with an injected filter.

  2. Test 2 Query-string operator injection (blind count oracle)

    Expected signal: Web log with URL-encoded %24gt operator in the query string.

  3. Test 3 Server-side JavaScript injection via $where in count filter

    Expected signal: Application and MongoDB logs showing a count operation with a $where expression.


Response Playbook

Triage

  1. Confirm whether the targeted application uses Mongoose and relies on `sanitizeFilter` as a NoSQL-injection defense; grep the app's package-lock/yarn.lock for an affected mongoose version (< 6.13.11, 7.x < 7.8.12, 8.x < 8.24.3, 9.x < 9.9.2).
  2. Extract the full offending request (URL, headers, body) from the alert and identify which endpoint and parameter carried the MongoDB operator; determine whether that parameter flows into a `countDocuments()` call.
  3. Correlate the source IP against authentication and WAF logs to decide whether the traffic is an authorized scanner, a known integration, or an unexpected external actor.
  4. Review MongoDB command/profiler logs for the same time window for `count` operations whose filter contains injected operators (`$where`, `$ne`, `$regex`, `$function`).

Containment

  1. Deploy a WAF/reverse-proxy rule to reject request bodies and query parameters containing raw `$`-prefixed MongoDB operators on affected endpoints until the library is patched.
  2. Upgrade mongoose to the fixed release for the running major (6.13.11 / 7.8.12 / 8.24.3 / 9.9.2) and redeploy; as a stopgap, add explicit server-side input validation/casting before any `countDocuments(filter)` call.
  3. If active data enumeration is confirmed, rotate any secrets or session tokens that could have been exposed via a count-based blind oracle and restrict database account privileges.

Evidence Collection

  1. Preserve raw web/WAF access logs containing the operator payloads and the correlated MongoDB profiler/command logs showing the injected count queries.
  2. Capture the application's dependency manifest (package-lock.json / yarn.lock) and running process version to document the exact vulnerable mongoose build.
  3. Snapshot relevant application logs and any server-side JavaScript evaluation errors (from `$where`/`$function`) for timeline reconstruction.

Escalation Criteria

  • !Escalate to incident response if MongoDB logs confirm injected count operators returned attacker-controlled boolean oracles indicating successful data enumeration or auth bypass.
  • !Escalate if the injection reached a `$where`/`$function` server-side JS path, indicating potential code-evaluation impact beyond data disclosure.
  • !Escalate to application owners and change management to expedite the mongoose upgrade when a vulnerable version is confirmed in production.

Investigation Guide

Forensic Artifacts

  • >Web/WAF access logs with `$`-prefixed MongoDB operators in query strings or JSON bodies.
  • >MongoDB profiler/command audit entries showing `count`/`countDocuments` filters containing injected operators.
  • >Application dependency lockfile recording the vulnerable mongoose version.

Tuning Guidance

First inventory which application endpoints legitimately accept MongoDB operator syntax and allowlist them, since those will generate benign matches. Lower the per-IP count threshold in low-traffic environments and raise it where operator-based filter APIs are common. Prioritize alerts that correlate a web-layer operator payload with a matching MongoDB count operation in the same time window, and deprioritize traffic attributable to authorized scanners by source IP.


Hunting Queries

Baseline hunt for any HTTP traffic carrying MongoDB operators across all endpoints to find injection probing beyond the alerting threshold.

Hunting — KQL
kql
// df00tech DF00-5bf92bc4d1 · https://df00tech.com/detections/CVE-2026-125120 · licence: https://df00tech.com/detections/licence
W3CIISLog | extend d = url_decode(tostring(csUriQuery)) | where d matches regex @"(\$where|\$ne|\$regex|\$function)" | summarize count() by cIP, csUriStem, bin(TimeGenerated, 1h)
Hunting — SPL
spl
``` df00tech DF00-5bf92bc4d1 · https://df00tech.com/detections/CVE-2026-125120 · licence: https://df00tech.com/detections/licence ```
index=web | eval d=urldecode(coalesce(request_body,uri_query)) | where match(d,"\$where|\$ne|\$regex|\$function") | stats count by src_ip, uri_path

Atomic Red Team Tests

Test 1 Operator injection into count endpoint via JSON body
linux

Sends an HTTP request with a MongoDB operator ($ne) embedded in a JSON filter to an endpoint that performs countDocuments, simulating a sanitizeFilter bypass attempt.

Command

bash
curl -s -X POST http://localhost:3000/api/users/count -H 'Content-Type: application/json' -d '{"username": {"$ne": null}}'

Cleanup

bash
echo 'No persistent changes; clear app request logs if desired: truncate -s 0 /var/log/app/access.log'

Expected Telemetry

Web/app access log entry with request body containing the $ne operator and a MongoDB count command log with an injected filter.

Expected Detection

KQL/SPL operator-injection rule fires on the $ne payload in the request body.

Test 2 Query-string operator injection (blind count oracle)
linux

Injects a $gt operator via URL query parameters to probe a count-based boolean oracle against a Mongoose-backed endpoint.

Command

bash
curl -s 'http://localhost:3000/api/items/count?qty%5B%24gt%5D=0'

Cleanup

bash
echo 'No cleanup required; stateless read request.'

Expected Telemetry

Web log with URL-encoded %24gt operator in the query string.

Expected Detection

Detection decodes the URL and matches the $gt MongoDB operator pattern.

Test 3 Server-side JavaScript injection via $where in count filter
linux

Attempts to inject a $where clause into a count request, simulating the most severe server-side JS evaluation path of the vulnerability.

Command

bash
curl -s -X POST http://localhost:3000/api/accounts/count -H 'Content-Type: application/json' -d '{"$where": "this.role == \"admin\""}'

Cleanup

bash
echo 'Stateless; no cleanup needed.'

Expected Telemetry

Application and MongoDB logs showing a count operation with a $where expression.

Expected Detection

Rules flag the $where operator in the request body and correlate with the MongoDB count command.

Related Detections