Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-118383 — Proof-of-concept for CVE-2026-118383, an unauthenticated MongoDB use-after-free in replication catch-up, with wire-protocol exploit scripts, a gdb crash oracle, and fixed-version controls. | Kitploit
Tools/GitHubGitHub/googlesky/cve-2026-118383
Memory ForensicsVulnerability AnalysisExploitationDebuggersPapers & ResearchDatabase Security
GitHubgooglesky/cve-2026-118383

CVE-2026-118383

Proof-of-concept for CVE-2026-118383, an unauthenticated MongoDB use-after-free in replication catch-up, with wire-protocol exploit scripts, a gdb crash oracle, and fixed-version controls.

View Repository
7 days agoNot yet reviewed
Share

CVE-2026-118383 — MongoDB pre-auth use-after-free in primary catch-up

CVECVE-2026-118383
ComponentMongoDB server, replication (ReplicationCoordinatorImpl)
Affected8.0.x before 8.0.37 (8.0.34 tested); 8.2 builds before the backport (8.2.12 tested)
Fixed in8.0.37 (23dfc54219, 6111165c32)
CWECWE-416 — use-after-free
TriggerUnauthenticated readConcern.afterOpTime waiter poisoning + primary catch-up abort
Impactmongod crash / memory corruption in the replication coordinator

A ReplicationCoordinatorImpl::CatchupState object can free itself while one of its own methods is still running. The completion callback registered for the primary catch-up waiter captures a raw this, ignores the completion status, and calls abort_inlock(kSucceeded) from inside abort_inlock(). The inner call resets _repl->_catchupState and destroys the object; the outer frame then continues to read and write through the freed pointer.

The waiter can be kept unfulfilled by an unauthenticated client. Two readConcern.afterOpTime waiters with adversarial opTime terms create an ordering cycle in std::multimap<OpTime, Waiter>, so the real catch-up waiter is never reached by setValueIf_inlock(). The next heartbeat concludes "already caught up" and aborts catch-up, which destroys the unfulfilled waiter and re-enters abort_inlock().

Two server fixes shipped in 8.0.37:

  • 23dfc542199ab3b88d6a9420b6cd3f125a897620 — SERVER-138175. CatchupState becomes enable_shared_from_this, _catchupState becomes a shared_ptr, and the callback holds a weak_ptr, returns on non-OK status, and only concludes catch-up if it still owns the current state.
  • 6111165c32bfc74f197e2dfeb9480d0b52154d68 — SERVER-138119. Rejects client-supplied readConcern.afterOpTime unless the client holds ActionType::internal.

Quick start

# 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
AUTH=1 MONGO_IMAGE=docker.io/mongodb/mongodb-community-server:8.0.37-ubi9 \
  ./run.sh control

run.sh <mode> tears down any previous replica set, starts three members, runs the PoC, captures the report and server logs under results/, and tears the set down again. A non-zero exit means the run did not reach an expected verdict. Use ./run.sh up and ./run.sh poc <mode> to keep a set running for inspection.

Requirements: Podman, mongosh (only used inside the MongoDB images), and Python 3.10+ if poc.py is run directly. The PoC itself has no third-party dependencies; mongo_wire.py implements BSON and OP_MSG from the standard library.

Root cause

Vulnerable code in src/mongo/db/repl/replication_coordinator_impl.cpp:

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
    }
};

Three conditions make the re-entry fatal:

  1. The node is in primary catch-up with a registered _waiter.
  2. The waiter is still unfulfilled even though lastApplied >= _targetOpTime.
  3. Any abort with a reason other than kSucceeded destroys the waiter. The synchronous callback observes that the target is already applied and calls abort_inlock(kSucceeded) again.

The second condition is reachable because OpTime::operator< is not a strict weak ordering when either side carries the legacy/uninitialized term -1:

inline bool operator<(const OpTime& rhs) const {
    if (_term == kUninitializedTerm || rhs._term == kUninitializedTerm)
        return _timestamp < rhs._timestamp;                                  // timestamp only
    return std::tie(_term, _timestamp) < std::tie(rhs._term, rhs._timestamp); // term first
}

Plant two waiters in this order:

  • W1 = {ts: applied + 1s, term: -1} — term omitted on the wire
  • W2 = {ts: Timestamp(1, 1), term: 2^40}

With W1 inserted first, the multimap order becomes W2, W1, C (where C is the catch-up waiter): W2 < W1 by timestamp, W1 < C by timestamp, and C < W2 by term. Iteration in setValueIf_inlock() starts at W2, whose key compares greater than any real lastApplied, so the loop stops before C. The poisoned ordering survives until the next heartbeat aborts catch-up.

Attack surface

readConcern is a generic command argument, and waitForReadConcern runs before command dispatch. The deprecated afterOpTime field was accepted from any connection, including unauthenticated clients and commands that require no privileges (ping, hello). The fixed jstest jstests/auth/after_op_time_requires_internal.js checks exactly that case.

The waiter-poisoning primitive needs no credentials. The reproduction also drives the election that turns the poison into catch-up state; on an auth-enabled deployment that step requires replica-set control. The security boundary crossed by SERVER-138119 is that any connection could register waiters on a secondary's last-applied list.

Why the control needs authentication

checkAuthForAfterOpTime() asks for ActionType::internal on the cluster. When security.authorization is disabled, that action is effectively granted to every client, so even 8.0.37 accepts afterOpTime without a keyFile. The auth fix is only observable on an auth-enabled deployment. AUTH=1 starts every member with a shared keyFile, bootstraps an admin user through the localhost exception, and leaves the attacker connection unauthenticated.

AUTH=1 supports control only. assisted and natural need the unauthenticated test commands used to hold the applier and are run with auth disabled.

PoC modes

  • assisted — deterministic. Enables the test-only failpoint pauseBatchApplicationAfterWritingOplogEntries on n2, so its oplog is current (it can win votes) while lastApplied lags (so primary catch-up registers a waiter). Both poison waiters are planted through unauthenticated ping commands with readConcern.afterOpTime. This isolates the UAF logic from timing noise.
  • natural — no failpoint. Plants the poison waiters asynchronously, drives a multi-threaded write burst against the primary, and forces the election while n2 is behind. Timing-sensitive: on a fast disk n2 can catch up before the post-election heartbeat fixes the target. It has produced DOUBLE_ABORT_UAF with N2_CPUS=0.25, six writers, and an 8-second backlog, but assisted is the reliable mode.
  • control — one unauthenticated ping with readConcern.afterOpTime and a short maxTimeMS. Vulnerable builds accept the read concern and the command waits (code 50, timeout). Fixed builds with auth reject it immediately with code 13 (Unauthorized).

Verified results

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    717
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    504
  • 3

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    402
  • 4

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    342
  • 5

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    260
  • 6

    antifox

    antifox-ai/antifox

    AI multi-agent autonomous penetration testing platform that runs recon, attack-surface discovery, exploitation validation and evidence-backed report delivery.

    259

Explore all tools

Browse our collection of tools

View all tools →