Introduction
A newly elected MongoDB replica set primary can be made to free and then reuse its own catch-up state object, and the request that nudges it there needs no authentication. That combination, an unauthenticated trigger and a use-after-free (CWE-416), is why CVE-2026-118383 is worth prioritizing for any replica set, including the shard and config server members that hold a sharded cluster together. Standalone mongod instances are out of scope.
MongoDB scored this flaw 9.0 under CVSS 3.1 and 9.5 under CVSS 4.0. The reported impact ranges from an unexpected server termination to, under certain conditions, arbitrary code execution in the context of the server process. The vendor says it found the issue internally through its proactive security program and was not aware of exploitation attempts at publication.
Technical Information
The vulnerable code path lives in MongoDB's replication coordinator and is tied to a newly elected primary concluding its catch-up phase. When a node wins an election, it creates a CatchupState object and registers a completion callback on an optime waiter. When the node reaches the target optime, the callback ends catch-up through abort_inlock(), and that call destroys the state object.
The root cause is reentrancy into that destruction. Before the fix, the callback captured a raw this pointer. The same waiter also completes with a non-OK status when it is torn down, which happens when catch-up is aborted, when the target changes, or on stepdown. So code that was already inside abort_inlock() and destroying the state could trigger the callback, and the callback would run abort_inlock() a second time on memory that was already being freed. The ticket title calls this CatchupState::abort() reentrancy. The waiter could also simply outlive the state.
The public PoC repository quotes the vulnerable path as documented in its README:
void ReplicationCoordinatorImpl::CatchupState::abort_inlock( PrimaryCatchUpConclusionReason reason) { ... if (reason != PrimaryCatchUpConclusionReason::kSucceeded && _waiter) { _repl->_lastAppliedOpTimeWaiterList.remove_inlock(_waiter); _waiter.reset(); // may synchronously run targetOpTimeCB } _repl->_enterDrainMode_inlock(); _repl->_catchupState.reset(); // destroys `this` } auto targetOpTimeCB = [this](Status status) { // status is ignored const auto myLastApplied = _repl->_getMyLastAppliedOpTime_inlock(); if (_targetOpTime <= myLastApplied) { ... abort_inlock(PrimaryCatchUpConclusionReason::kSucceeded); // re-enters } };
The inner abort_inlock resets _repl->_catchupState and destroys the object, after which the outer frame keeps reading and writing through the freed pointer.
The attack surface that reaches this code is the readConcern.afterOpTime waiter list. Client read requests carrying readConcern.afterOpTime leave waiters in the same waiter list that catch-up uses, and that registration required no credentials. The PoC keeps the real catch-up waiter perpetually unfulfilled by exploiting a non-strict-weak-ordering bug in OpTime::operator< when a term is the uninitialized value -1.
The attack flow, as described in the PoC materials, runs roughly like this. An attacker plants two unauthenticated readConcern.afterOpTime waiters with adversarial opTime terms: W1 = {ts: applied+1s, term: -1} and W2 = {ts: Timestamp(1,1), term: 2^40}. These create an ordering cycle in the std::multimap<OpTime, Waiter> so that setValueIf_inlock() never reaches the real catch-up waiter. The next heartbeat then concludes that the node is already caught up, aborts catch-up, and re-enters abort_inlock(), triggering the double abort over freed memory.
The CVE description notes arbitrary code execution is possible only under certain conditions. The available sources do not explain those conditions, and the claim should not be read as saying every trigger reliably yields code execution.
Proof of Concept
A public, working PoC is published at github.com/googlesky/CVE-2026-118383 (MIT-licensed, Python, created 2026-11-11, default branch main). It targets the use-after-free in ReplicationCoordinatorImpl::CatchupState during primary catch-up and matches the NVD description: CWE-416, CVSS 4.0 of 9.5, unauthenticated trigger, affecting replica set members.
The repository contains runnable components including poc.py (assisted, natural, and control modes), mongo_wire.py (a dependency-free BSON and OP_MSG wire client built from the Python standard library), run.sh (Podman replica set orchestration), attacker and debug container files, and a gdb-based deterministic UAF oracle (tools/uaf_run.sh, tools/uaf_oracle.gdb). An evidence/ directory holds archived reports and server log excerpts.
The PoC offers three modes:
- assisted: deterministic; enables the test-only failpoint
pauseBatchApplicationAfterWritingOplogEntriesso a secondary'slastAppliedlags while its oplog is current, then plants both poison waiters via unauthenticatedpingcommands. - natural: no failpoint, realistic but timing-sensitive (reported to produce
DOUBLE_ABORT_UAFwithN2_CPUS=0.25, six writers, and roughly an 8 second backlog). - control: one unauthenticated
pingwithreadConcern.afterOpTime; vulnerable builds accept it (they wait, then return code 50 timeout), while fixed and authenticated builds reject with code 13 (Unauthorized).
Usage from the README:
# Vulnerable 8.0.34: deterministic double abort (UAF fingerprint) ./run.sh assisted # Fixed 8.0.37: same attack, no double abort MONGO_IMAGE=docker.io/mongodb/mongodb-community-server:8.0.37-ubi9 ./run.sh assisted # Unauthenticated afterOpTime acceptance, vulnerable vs fixed AUTH=1 ./run.sh control
Requirements are Podman, mongosh (used inside the images), and Python 3.10 or later if poc.py is run directly.
Verified results reported in the repository include: mongo:8.0.34 assisted produced DOUBLE_ABORT_UAF; the mongo:8.0.34 gdb oracle produced UAF_CRASH (SIGSEGV at abort_inlock+0x1a0); mongo:8.0.34 control with AUTH=1 accepted the unauthenticated afterOpTime (code 50 after about 1 second); mongodb-community-server:8.0.37-ubi9 assisted produced POISON_HELD_BUT_NO_DOUBLE_ABORT; 8.0.37-ubi9 control with AUTH=1 produced FIXED_REJECTS_UNAUTH_AFTEROPTIME (code 13); and mongo:8.2.12 assisted produced DOUBLE_ABORT_UAF. The vulnerable fingerprint is a single resume incrementing both numCatchUpsSucceeded and numCatchUpsAlreadyCaughtUp, plus two Exited primary catch-up mode log lines with identical timestamps.
On scope and limitations: the PoC demonstrates the use-after-free through a deterministic double-abort fingerprint and a gdb-assisted SIGSEGV crash oracle; it does not demonstrate arbitrary code execution. The reliable assisted and natural modes require enableTestCommands=1 and a test-only failpoint (not remotely reachable), used only to remove timing noise, while the poison waiters and election trigger are real wire-protocol operations. The underlying afterOpTime waiter-registration primitive itself needs no credentials. The vulnerability maps to SERVER-138175 and SERVER-138119, both fixed in 8.0.37 and referenced from the NVD record.
Patch Information
MongoDB fixed CVE-2026-118383 with two changes, tracked as SERVER-138175 and SERVER-138119. The first repairs the use-after-free in the replication coordinator; the second closes the unauthenticated path that let a client reach the buggy code. Both Jira tickets are marked Fixed and carry the same fix versions: 9.0.7, 8.3.16, 8.0.37, 7.0.48, 6.0.30, plus 5.0.35 and 4.4.32. NVD's affected ranges end just below the first five of those versions. The commits quoted below are the public v6.0 backports linked from each ticket.
Fix 1: the memory-safety bug (SERVER-138175, commit dbc6f588)
The commit message describes the fix as: "Conclude primary catch-up only from a live, current catch-up state." The patch does three things:
- Ownership changes from unique to shared/weak.
_catchupStatechanges from astd::unique_ptrto astd::shared_ptr, andCatchupStatenow inherits fromstd::enable_shared_from_this. The replication coordinator holds the only strong reference; the waiter's callback holds a weak one, because the waiter can be completed while the state is being destroyed or after it is gone. - Teardown completions are ignored. A non-OK status means whoever destroyed the waiter is already ending catch-up, so the callback returns immediately.
- Identity check. The callback calls
lock()on its weak pointer and continues only if the object still exists and is still the coordinator's current_catchupState.
The core of the change in replication_coordinator_impl.cpp:
- auto targetOpTimeCB = [this](Status status) { - // Double check the target time since stepdown may signal us too. - const auto myLastApplied = _repl->_getMyLastAppliedOpTime_inlock(); - if (_targetOpTime <= myLastApplied) { + auto targetOpTimeCB = [weakSelf = weak_from_this()](Status status) { + if (!status.isOK()) { + return; + } + auto self = weakSelf.lock(); + if (!self || self->_repl->_catchupState != self) { + return; + } + const auto myLastApplied = self->_repl->_getMyLastAppliedOpTime_inlock(); + if (self->_targetOpTime <= myLastApplied) { ... - abort_inlock(PrimaryCatchUpConclusionReason::kSucceeded); + self->abort_inlock(PrimaryCatchUpConclusionReason::kSucceeded);
In the new code, every member access goes through self, a strong reference that keeps the object alive for the whole callback. The commit adds two regression tests to replication_coordinator_impl_elect_v1_test.cpp: AlreadyCaughtUpWithUnfulfilledWaiterConcludesOnce and TargetChangeWithUnfulfilledWaiterKeepsCatchingUp. Both plant abandoned afterOpTime read waiters with deliberately unordered optime keys so the catch-up waiter stays unfulfilled, then check that catch-up ends exactly once and that the node goes on to accept writes.
Fix 2: closing the attack surface (SERVER-138119, commit c4ecf98a)
The second commit, titled "Allow only internal users to use readConcern.afterOpTime", adds a check in commands.cpp that runs inside CommandInvocation::checkAuthorization(), before the command's own authorization check:
+ auto authSession = AuthorizationSession::get(opCtx->getClient()); + const bool isInternal = authSession->isAuthorizedForActionsOnResource( + ResourcePattern::forClusterResource(), ActionType::internal); + if (isInternal) { + metrics->recordAcceptedAfterOpTime(); + } else { + metrics->recordRejectedAfterOpTime(); + uasserted(ErrorCodes::Unauthorized, + "Not authorized to run command with readConcern.afterOpTime"); + }
Any request whose readConcern contains afterOpTime is now rejected with Unauthorized unless the client holds the cluster-level internal action, which in practice means intra-cluster or __system identities. The new jstest jstests/auth/after_op_time_requires_internal.js shows this covers unauthenticated connections running commands that normally need no privileges, such as ping and hello, as well as nested explain read concerns, and it applies on both mongod and mongos.
Two supporting pieces ship with this change. The first is a new runtime-settable server parameter allowDeprecatedAfterOpTimeReadConcern (default false), described as a temporary escape hatch for deployments that still depend on it; when enabled, it reintroduces the exposed path, including for unauthenticated clients. The second is a set of new serverStatus counters under readConcernCounters.afterOpTime (accepted and rejected) that let operators see whether anything still sends the deprecated argument.
SERVER-138175 makes the catch-up state's lifetime correct no matter how waiters complete, which removes the use-after-free. SERVER-138119 is defense in depth: untrusted clients can no longer plant arbitrary optime waiters on a replica set member. Both are labeled Fully Compatible. The only behavior change for applications is that a non-internal client sending afterOpTime now gets an error.
Affected Systems and Versions
The CVE record identifies MongoDB Server versions from 9.0.0 up to, but not including, 9.0.7 as affected. The fix versions are 9.0.7, 8.3.16, 8.0.37, 7.0.48, and 6.0.30, plus 5.0.35 and 4.4.32. NVD's affected ranges end just below the first five of those versions. MongoDB release material identifies 9.0.7 as production ready and recommends it for 9.0 users; 8.3.16 contains the fix, and 8.3.17 was later announced as production ready. The branch list for 8.0, 7.0, 6.0, 5.0, and 4.4 is drawn from the patch and secondary reporting; confirm the applicable release against MongoDB's current official release information before rollout, particularly for the older branches.
Only replica set members are affected, including the shard and config server replica set members of sharded clusters. Standalone mongod instances are out of scope and should not be treated as in scope for this CVE.
Vendor Security History
MongoDB operates a documented vulnerability reporting process through its HackerOne bug bounty program, and its security team reviews and validates submissions under its vulnerability disclosure policy. For CVE-2026-118383, MongoDB says it found the flaw internally through its proactive security program and issued a security notice on November 10, 2026. In a separate December 2025 disclosure, MongoDB's Security Engineering team identified CVE-2025-14847 and published it through the CVE process on December 19, 2025. These examples show a documented disclosure and patching workflow, but they are not enough to assign a comparative security rating or characterize the company's overall vulnerability rate.
References
- NVD: CVE-2026-118383
- CVE Record: CVE-2026-118383
- MongoDB SERVER-138175
- MongoDB SERVER-138119
- GitHub Advisory GHSA-fjxh-6vgh-cx2c
- MongoDB Security Update Notice, November 10, 2026
- MongoDB 9.0.7 is released
- MongoDB 8.3.17 is released
- Release Notes for MongoDB 8.3
- HKCERT: MongoDB Multiple Vulnerabilities
- SecurityOnline: MongoDB Server 9.0.7 Fixes CVE-2026-118383
- CWE-416: Use After Free
- Public PoC: github.com/googlesky/CVE-2026-118383
- PoC Repository API metadata
- PoC README
- Patch commit dbc6f588 (SERVER-138175)
- Patch commit c4ecf98a (SERVER-138119)
- MongoDB: Addressing Security Vulnerabilities
- MongoDB Server Security Update, December 2025



