CVE-2026-118383, a pre-auth use-after-free in MongoDB Server (CVSS 4.0 9.5), lets an unauthenticated client plant two requests that crash a lagging replica set member once it wins an election. MongoDB says it knows of no exploitation attempts.
- Mechanism: the two requests are ping commands carrying a readConcern.afterOpTime value. Each makes the server record a pending notification, a waiter. Planting them does not crash anything. The waiters persist until the member restarts, rolls back, or steps down. If that member later wins an election while behind, the cleanup at the end of primary catch-up runs twice on already-freed memory. The new primary crashes before accepting writes, and the crash does not depend on a timing race. MongoDB says code execution is possible under certain conditions, but Datadog Security Labs did not achieve it in their lab.
- Scope: members of replica sets, including shard and config server members of sharded clusters. A standalone mongod is not affected. Every earlier version in an affected branch is vulnerable, back to the branch's first release. Turning on authentication does not stop the two requests on vulnerable versions. The researchers stress the attacker cannot make a member fall behind, win an election, or see either happen. In the lab they paused and stopped mongod processes with admin access to force it. On 8.0.34 the member segfaulted and left the lab cluster with no primary.
- Fix: 8.0.37 rejected both requests as unauthorized immediately. One part restricts readConcern.afterOpTime to system users. A second part stops the cleanup from running twice even when waiters exist. The researchers did not test that second part themselves. In the proof-of-concept lab with authentication off, 8.0.37 accepted the waiters but ran cleanup once. Fixed releases per branch are in the CVE record. Atlas clusters get fixes during maintenance, so deferred maintenance leaves them exposed.
- 8.2 caveat: 8.2 is not in the affected list, and 8.2.12 is its newest release. But a public proof of concept reports 8.2.12 still showed the bug using a test-only setting a remote attacker cannot enable. The branch reached end of life on July 31, so it gets no security fixes. Treat any 8.2 replica set as an upgrade candidate.
- Log evidence from the researchers' vulnerable run: a COMMAND "Slow query" entry (ID 51803) for an unauthenticated ping with readConcern.afterOpTime ending in MaxTimeMSExpired. Then a member entering primary catch-up (ID 21359) and exiting it twice (ID 21363) in a single transition. Then a fatal signal or backtrace involving CatchupState::abort_inlock(). A normal election or a single catch-up exit does not indicate this flaw.
Takeaway: scope first. Inventory every replica set, shard, and config server member and confirm the running version on each, including containers and members that were offline during maintenance. Then hunt backward from any unexplained primary crash or failover. Search structured logs on the crashed member for ID 21363 appearing twice in one transition, then pivot to earlier logs from the same member for ID 51803 pings with afterOpTime, since the planting can precede the failover by a long time. Request fields are only logged depending on logging settings, and attr.remote may show a loopback address instead of the real client IP, so absence of evidence is weak. Preserve logs and core dumps before restarting members, because a restart clears planted waiters. Until upgrades land, restrict network access to only the systems that need it. That limits who can send the requests but does not fix the flaw.