Introduction
A use-after-free in MongoDB Server's server-side JavaScript support lets an authenticated user, including one with minimal or no assigned roles, read freed process memory by sending a single crafted aggregation request. For deployments that hand out low-privilege database accounts to applications, analysts or tenants, the account boundary is not the exposure boundary. Leaked memory can include data that undermines ASLR, and the condition may in some cases affect server availability.
NVD lists the vendor for CVE-2026-120818 as unknown, but the affected product is MongoDB Server and the CVE Numbering Authority is MongoDB, Inc. MongoDB scores the issue 7.1 High under both CVSS 4.0 and CVSS 3.1. The documented impact is memory disclosure with possible availability effects. No code execution chain has been demonstrated.
Technical Information
Root cause: a missing generation bump in $accumulator
MongoDB's Jira ticket SERVER-135727, titled "$accumulator missing advanceGeneration() causes use-after-free", states the root cause directly: the legacy MozJS engine does not call advanceGeneration() before running an $accumulator function. As a result, global objects left over from an earlier invocation, whose memory has already been freed, "can be reread". MongoDB notes this could expose "all kinds of internal process data".
Background on how MongoDB runs server-side JavaScript:
- MongoDB runs server-side JavaScript in an embedded SpiderMonkey (MozJS) scope.
- Documents are passed into that scope as JS objects that point at BSON memory owned by the server, not copies owned by the script engine.
- The scope keeps a generation counter. Calling
advanceGeneration()increments it, which tells the engine that objects tied to an earlier generation are stale and must not be read through. - An
$accumulatorruns user JavaScript repeatedly within one aggregation: init, accumulate, merge and finalize.
If the generation is not advanced between those calls, a JS global assigned during one call can still reference BSON memory that the server released after that call returned. When the next call touches that global, it dereferences freed heap memory. Whatever now occupies that region can be read and returned through the aggregation output. That lines up with the CVE description: a stale reference to previously freed process memory is read and returned, exposing adjacent memory contents, including data that weakens memory layout randomization.
The disclosure concerns process memory, not a logic flaw that returns other users' documents through normal query semantics. What leaks depends on heap state at the time of the read, which is also why the published scoring treats availability impact as low rather than as a guaranteed crash.
Attack flow
Based on the published description and scoring, the exploitation sequence looks like this:
- The attacker authenticates to MongoDB with any account. The description explicitly covers users with minimal or no assigned roles.
- Over the normal MongoDB network protocol, the attacker submits one crafted aggregation request that uses
$accumulatorwith JavaScript designed to retain a reference to BSON-backed data in a global across invocations. - Because
advanceGeneration()is not called on entry to the next$accumulatorinvocation, the stale global still resolves to memory that has since been freed. - The script reads through the stale reference and places the result into the accumulator state, which the server returns in the aggregation output.
- The attacker receives adjacent process memory, potentially including pointer values that help defeat ASLR. In some cases the access may instead disrupt server availability.
No additional privileges or non-default configuration are required, and repeated requests are not a stated prerequisite. The reviewed sources do not include a reproducible payload, so we are not publishing one.
Prerequisites at a glance
- Attack vector: Network, via the normal MongoDB protocol
- Attack complexity: Low (
AC:Lin both vectors) - Privileges: Authenticated user with minimal or no roles (
PR:L, notPR:N) - User interaction: None (
UI:N) - Configuration: No non-default configuration required
- Trigger: A single crafted aggregation request
For scoping, "no assigned roles" does not mean "no authentication". The realistic attacker is someone holding any valid credential, not an anonymous internet client.
Scoring
MongoDB's published vectors:
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:L/SC:N/SI:N/SA:N CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:L
Both resolve to 7.1 High: high confidentiality impact, no integrity impact and low availability impact on the vulnerable system, with no subsequent system impact under CVSS 4.0. The score reflects the confidentiality exposure far more than availability.
Patch Information
MongoDB fixed CVE-2026-120818 under SERVER-135727, which NVD lists as the vendor's official reference. The Jira issue is marked Fixed (Critical, P2). It was opened on Sep 25, 2026, resolved on Oct 1, 2026, and backported to the v8.3, v8.0 and v7.0 branches.
The fix adds the missing advanceGeneration() call to the $accumulator entry path. Each invocation now starts in a new generation, so stale references from a previous call are treated as invalid and are no longer dereferenced. The ticket rates the change "Fully Compatible", so valid $accumulator code that does not depend on references retained from a previous call should behave as before.
Fixed releases (all published Nov 10, 2026):
- 8.3 branch: 8.3.0 up to but not including 8.3.16, fixed in 8.3.16
- 8.0 branch: 8.0.0 up to but not including 8.0.37, fixed in 8.0.37
- 7.0 branch: 7.0.0 up to but not including 7.0.48, fixed in 7.0.48
The release notes for all three versions list CVE-2026-120818 as fixed and include SERVER-135727 among the resolved issues. The 7.0 changelog files it under "Internals". We could not find a public commit, diff or GitHub advisory for SERVER-135727, so no code is shown here. The fix details come from the Jira ticket and MongoDB's release notes.
A recurring bug class
This is the second fix of its kind. The earlier SERVER-128473 ("Fix a use-after-free in $function caused by a missing advanceGeneration() call on retained BSON arguments") fixed the same mistake in $function and shipped in 8.3.7, 8.0.28 and 7.0.39. That fix did not cover $accumulator, which remained exposed until SERVER-135727. For anyone auditing embedded scripting code, the lesson is to enumerate every place host-owned memory crosses into a script engine, not only the first one someone reports.
Configuration hardening and its limits
MongoDB's server-side JavaScript documentation states that all server JavaScript execution can be disabled by setting security.javascriptEnabled to false in the configuration file for both mongod and mongos, and points users who do not need server JavaScript to that guidance. Two caveats apply:
- The CVE record does not present this as a validated workaround for CVE-2026-120818.
- It disables all server JavaScript, including
$accumulator,$functionand$where, rather than repairing the stale reference. Applications that rely on these operators will break.
$accumulator, $function and $where are also deprecated starting in MongoDB 8.0 and emit a warning when executed. Deprecation is not removal, and the CVE record explicitly lists affected 8.0 releases.
For Atlas, MongoDB documents automatic updates and security patches as a service capability, but the reviewed sources do not establish the rollout status of this specific fix across the Atlas fleet.
Affected Systems and Versions
MongoDB Server, in the following ranges per the CVE record:
- MongoDB Server 8.3: versions 8.3.0 through 8.3.15 (
8.3.0 <= version < 8.3.16) - MongoDB Server 8.0: versions 8.0.0 through 8.0.36 (
8.0.0 <= version < 8.0.37) - MongoDB Server 7.0: versions 7.0.0 through 7.0.47 (
7.0.0 <= version < 7.0.48)
Vulnerable configuration: the default. The description requires no non-default configuration, so any affected mongod or mongos with server-side JavaScript enabled and reachable by an authenticated user, however low privilege, is in scope. Use the threshold for your branch rather than importing version requirements from other MongoDB advisories.
Vendor Security History
MongoDB, Inc. (Nasdaq: MDB) runs a HackerOne bug bounty program and a documented disclosure process: acknowledgment may take up to one week, and public disclosure is coordinated after validation and notification of users and partners.
The most relevant recent precedent is CVE-2025-14847, informally called MongoBleed, also a memory disclosure issue. MongoDB's Security Engineering team detected it on December 12, 2025. Most of Atlas was patched by December 17 and the remainder, including instances with maintenance windows, by December 18. Public disclosure followed on December 19. Customer-operated servers required manual patching. Unit 42 reported a working public proof of concept on December 26, 2025, and CISA added the CVE to KEV on December 29, 2025, based on evidence of active exploitation.
That case differs from this one. MongoBleed was an unauthenticated compressed message processing weakness, while CVE-2026-120818 requires authentication and lives in the JavaScript aggregation path. Its exploit and activity cannot be attributed to the current CVE. It does show that fast vendor remediation and later exploitation of unpatched self-managed deployments are not mutually exclusive.
For CVE-2026-120818 specifically, the consulted trackers report no confirmed active exploitation, no confirmed public exploit code, no KEV listing, no named threat actor and no ransomware linkage, with EPSS evaluation still in progress. Those are statements about available reporting, not proof of absence.
The SERVER-128473 to SERVER-135727 sequence described above is part of this history too: the same missing advanceGeneration() pattern appeared in two separate operators, fixed several releases apart.
References
- NVD: CVE-2026-120818
- CVE Record: CVE-2026-120818
- MongoDB Jira: SERVER-135727
- MongoDB 8.3 Release Notes
- MongoDB 8.0 Release Notes
- MongoDB 7.0 Release Notes
- MongoDB 7.0 Changelog
- MongoDB 8.3 Changelog (manual)
- MongoDB 8.3 Changelog (v8.3 docs)
- MongoDB Docs: Server side JavaScript (v8.0)
- MongoDB Docs: Server side JavaScript (v7.0)
- Cyber Security Agency of Singapore: High Severity Vulnerability in MongoDB Server
- CERT FR: Multiples vulnérabilités dans MongoDB Server
- Canadian Centre for Cyber Security: MongoDB security advisory AV26 810
- isMalicious: CVE-2026-120818
- TheHackerWire: CVE-2026-120818 Analysis and Fix
- CISA Known Exploited Vulnerabilities Catalog
- MongoDB Server Security Update, December 2025
- CISA Adds One Known Exploited Vulnerability to Catalog (December 29, 2025)
- Unit 42 Threat Brief: MongoDB Vulnerability CVE-2025-14847
- MongoDB: Create a Vulnerability Report
- MongoDB Vulnerability Disclosure Policy
- MongoDB Atlas Database
- MongoDB, Inc. SEC Filing



