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
Tools/GitHubGitHub/googlesky/cve-2026-126837
Vulnerability AnalysisExploitationWeb SecurityNetwork SecurityLearning & EducationDNS AnalysisLabs & Practice
GitHubgooglesky/cve-2026-126837

CVE-2026-126837

Containerized differential lab and PoC for CVE-2026-126837, demonstrating SRV target redirection in the MongoDB Node.js driver and SCRAM credential capture on 7.7.0 vs 7.8.0.

View Repository
6 days agoNot yet reviewed
Share

CVE-2026-126837 — MongoDB Node.js driver connects outside the SRV parent domain when the SRV target contains a URL-terminating character

FieldValue
CVECVE-2026-126837
ComponentMongoDB Node.js driver (mongodb, mongodb/node-mongodb-native) — Initial DNS Seedlist Discovery
Affected3.3.3 .. < 7.8.0 (semver)
Fixed in7.8.0 (commit 19e2d3b83, NODE-7830)
CWECWE-180 — Validate Before Canonicalize
CVSS4.0 — 9.1 CRITICAL (CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N); 3.1 — 7.4 HIGH
ImpactRedirection of database traffic to an attacker host: credential interception (SCRAM proof offline-crackable), unintended disclosure of application data, altered query results
VectorForged or attacker-influenced DNS SRV response for a mongodb+srv:// connection string
TriggerSRV target name containing #, ?, or / before the parent-domain suffix
CreditVendor advisory (no reporter named in the CVE record)

A validation flaw in the driver's SRV parent-domain guard lets a party who can forge or modify the DNS SRV response redirect a mongodb+srv:// client to any host of their choosing. The guard compares the SRV target against the parent domain with a plain endsWith on a string whose syntax was never validated; the driver then re-parses the same string as a URL, where #, ? and / terminate the host name early. The connection is established to the attacker host with TLS turned against the victim: the certificate is validated against the redirected name, which the attacker legitimately owns. The client then sends its SCRAM authentication exchange — including a client proof derived from the password — to the attacker. Applications using plain mongodb:// URIs are not affected.

1. Root cause

The vulnerable guard, src/utils.ts:1158 in v7.7.0:

export function checkParentDomainMatch(address: string, srvHost: string): void {
  // Remove trailing dot if exists on either the resolved address or the srv hostname
  const normalizedAddress = address.endsWith('.') ? address.slice(0, address.length - 1) : address;
  const normalizedSrvHost = srvHost.endsWith('.') ? srvHost.slice(0, srvHost.length - 1) : srvHost;

  const allCharacterBeforeFirstDot = /^.*?\./;
  // Remove all characters before first dot
  const addressDomain = `.${normalizedAddress.replace(allCharacterBeforeFirstDot, '')}`;
  ...
  if (!addressDomain.endsWith(srvHostDomain)) {
    throw new MongoAPIError('Server record does not share hostname with parent URI');
  }
}

The guard strips one trailing dot, removes everything up to the first ., and calls endsWith. It performs no syntax validation of the SRV target. The validated string then flows to HostAddress.fromString() and is re-parsed in the HostAddress constructor (src/utils.ts:890):

const urlString = `iLoveJS://${escapedHost}`;
url = new URL(urlString);
...
const hostname = url.hostname;

The arithmetic that breaks, for SRV host cluster0.lab.mongodb.test (parent .lab.mongodb.test) and forged target evil.attacker.test#.lab.mongodb.test:

guard:     "evil.attacker.test#.lab.mongodb.test"
           remove everything before first dot -> tail ".lab.mongodb.test" retained
           -> endsWith(".lab.mongodb.test") = TRUE   -> guard PASSES
URL parse: iLoveJS://evil.attacker.test#.lab.mongodb.test:27017
           "#" starts the fragment -> hostname = "evil.attacker.test", port falls back to 27017
           -> driver connects to evil.attacker.test

The # never blocks the suffix comparison because the guard compares the raw string tail (whose # sits before the suffix), while the WHATWG URL parser treats the same # as the fragment delimiter and truncates the host name.

The fix in 7.8.0, src/utils.ts:1185-1216, canonicalizes before validating:

const FORBIDDEN_DOMAIN_CODE_POINTS = /[\u0000-\u0020\u007F#%/:<>?@[\\\]^|]/;

export function dnsNameToASCII(name: string): string | null {
  if (FORBIDDEN_DOMAIN_CODE_POINTS.test(name)) {
    return null;
  }
  const ascii = /^\p{ASCII}*$/u.test(name) ? name.toLowerCase() : domainToASCII(name);
  return ascii === '' ? null : ascii;
}

export function normalizeDnsName(name: string): string {
  const withoutTrailingDot = name.endsWith('.') ? name.slice(0, -1) : name;
  const normalized = dnsNameToASCII(withoutTrailingDot);
  if (normalized == null) {
    throw new MongoAPIError('Invalid DNS host name');
  }
  return normalized;
}

Applied at the single SRV call site, src/connection_string.ts:128-130:

const host = normalizeDnsName(name);
verifySrvHost(host, lookupAddress, options);
return HostAddress.fromString(`${host}:${port ?? 27017}`);

Any #, ?, / or other WHATWG-forbidden code point now throws MongoAPIError: Invalid DNS host name before the guard, before HostAddress.fromString, and before any socket is opened.

2. Reproduction environment

One container image (cve-2026-126837:vuln) carries the entire differential:

  • authoritative DNS server (lab/src/dnsd.py) on 127.0.0.1:53 — the container's /etc/resolv.conf points at it, so every name resolution (including Node's c-ares SRV lookup) goes through attacker-controlled DNS. It answers the SRV query _mongodb._tcp.cluster0.lab.mongodb.test with the attacker-chosen target and resolves evil.attacker.test to 127.0.0.1;
  • attacker listener (lab/src/evilserver.py) on 127.0.0.1:27017 — TLS endpoint with a certificate issued by the lab CA (stand-in for the publicly-trusted certificate an attacker holds for its own domain), speaking enough MongoDB wire protocol (OP_QUERY ismaster, OP_MSG hello/saslStart/saslContinue) to complete the SDAM handshake and capture the SCRAM-SHA-256 exchange;
  • victim service (lab/src/service.js) — runs each connection attempt with a child process of the selected driver build (so a driver-level failure is observed rather than taking the service down) and exposes the attacker's and the DNS server's observations over HTTP;
  • driver builds in one image, selected per request: vuln = [email protected], fixed = [email protected], plus v6 = 6.22.0, v5 = 5.9.2, v4 = 4.17.2, v3 = 3.7.4 for the affected-range matrix.

The vulnerable and fixed sides differ only in the driver package version: same base image, same DNS server, same attacker listener, same service, same connection attempt.

3. Running the environment

./run-lab.sh build    # build lab + poc images
./run-lab.sh up       # create network cve126837lab, start lab, wait for health
./run-lab.sh all      # build, up, every PoC mode, capture evidence/, down-state logs

Individual modes:

./run-lab.sh poc check --driver vuln     # exit 1 = vulnerable
./run-lab.sh poc check --driver fixed    # exit 0 = safe
./run-lab.sh poc exploit --driver vuln   # full SCRAM credential capture
./run-lab.sh poc probe                   # companion primitives, differential
./run-lab.sh poc mitigation --driver vuln
./run-lab.sh poc sweep                   # 42-payload 0-day sweep on both builds
./run-lab.sh poc versions                # 3.x .. 7.x affected-range matrix
./run-lab.sh state                       # copy DNS/attacker logs into evidence/

make build|up|down|check-vuln|check-fixed|exploit-vuln|exploit-fixed|probe|sweep|versions|all mirrors the same targets. The PoC itself is stdlib-only Python 3 and also runs directly as python3 poc/poc.py <mode> against any reachable lab service.

4. The PoC

poc/poc.py, six modes, stable exit codes:

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.

    945
  • 2

    ghostlock-app

    yukonga/ghostlock-app

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

    555
  • 3

    redforge

    cybersecurity91/redforge

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

    350
  • 4

    ARTEX

    baarai/artex

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

    339
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    338
  • 6

    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.

    292

Explore all tools

Browse our collection of tools

View all tools →