CVE-2026-5187 PUBLISHED

Heap Out-of-Bounds Write in DecodeObjectId() in wolfSSL

Assigner: wolfSSL
Reserved: 30.03.2026 Published: 09.04.2026 Updated: 09.04.2026

Two potential heap out-of-bounds write locations existed in DecodeObjectId() in wolfcrypt/src/asn.c. First, a bounds check only validates one available slot before writing two OID arc values (out[0] and out[1]), enabling a 2-byte out-of-bounds write when outSz equals 1. Second, multiple callers pass sizeof(decOid) (64 bytes on 64-bit platforms) instead of the element count MAX_OID_SZ (32), causing the function to accept crafted OIDs with 33 or more arcs that write past the end of the allocated buffer.

Metrics

CVSS Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:L/UI:N/VC:N/VI:L/VA:L/SC:N/SI:N/SA:N
CVSS Score: 2.3

Product Status

Vendor wolfSSL
Product wolfSSL
Versions Default: unaffected
  • affected from 0 to 5.9.0 (incl.)

Affected Configurations

Bug 1 (off-by-one) affects any code calling DecodeObjectId() with an output buffer of size 1. Bug 2 (sizeof mismatch) is reachable via network when wolfSSL is compiled with HAVE_OID_DECODING or WOLFSSL_ASN_PRINT, and WC_ASN_UNKNOWN_EXT_CB is enabled with a registered unknown extension callback.

Workarounds

Do not enable WC_ASN_UNKNOWN_EXT_CB or do not register an unknown extension callback if not required. This mitigates the network-reachable variant (Bug 2) but does not address Bug 1.

Solutions

Fix Bug 1: Add a bounds check requiring at least 2 output slots before writing the first OID arc split (y == 0 case). Fix Bug 2: Change callers to pass the element count (MAX_OID_SZ) instead of sizeof(decOid) as the output buffer size parameter.

Credits

  • ytsun, Independent Security Researcher finder

References

Problem Types

  • CWE-122: Heap-based Buffer Overflow CWE
  • CWE-787: Out-of-bounds Write CWE