OISM libcoap, NULL pointer dereference, CVE-2025-65497 (Medium)

Listen to this Post

The CVE-2025-65497 vulnerability involves a NULL pointer dereference in the coap_dtls_generate_cookie() function within the src/coap_openssl.c file of OISM libcoap version 4.3.5. This function is part of the DTLS (Datagram Transport Layer Security) implementation used for securing CoAP (Constrained Application Protocol) communications. During a DTLS handshake, the function calls SSL_get_SSL_CTX() to retrieve the SSL context pointer associated with a given SSL session. However, when a remote attacker crafts a malicious DTLS handshake message, it can trigger SSL_get_SSL_CTX() to return a NULL pointer instead of a valid context. The code in coap_dtls_generate_cookie() then attempts to dereference this NULL pointer, leading to a segmentation fault or crash in the application. This dereference occurs because the function does not properly check the return value of SSL_get_SSL_CTX() for NULL before using it. As a result, the libcoap library or any application using it may abruptly terminate, causing a denial of service (DoS). The vulnerability is exploitable remotely without authentication, as the attacker only needs to send a crafted DTLS packet to the affected service. This issue stems from inadequate error handling in the OpenSSL integration code, assuming that SSL_get_SSL_CTX() always returns a valid pointer. The crash can disrupt CoAP-based IoT devices or servers, rendering them unavailable. Fixing this requires adding a NULL check before dereferencing the pointer in the coap_dtls_generate_cookie() function.
Platform: OISM libcoap
Version: 4.3.5
Vulnerability: NULL pointer dereference
Severity: Medium
date: 11/24/2025

Prediction: Patch TBA

What Undercode Say:

Analytics:

Check libcoap version
coap-client --version
Compile with debug symbols
gcc -g -o coap_test coap_source.c -lcoap
Use gdb to analyze crash
gdb ./coap_test
Network capture for DTLS
tcpdump -i any -w dtls.pcap port 5684
// Code snippet from coap_openssl.c
SSL_CTX ctx = SSL_get_SSL_CTX(ssl);
if (!ctx) {
// Missing NULL check leads to dereference
return error;
}
// Vulnerable dereference
char cookie = ctx->generate_cookie(data);

how Exploit:

Craft malicious DTLS handshake packets targeting coap_dtls_generate_cookie() to trigger NULL return from SSL_get_SSL_CTX(), causing crash and DoS.

Protection from this CVE:

Update libcoap to patched version, implement input validation, use firewall rules to limit DTLS traffic, and monitor for crashes.

Impact:

Denial of service, application crash, disruption of IoT communications.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: nvd.nist.gov
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top