GHSA-pj89-8hch-p7vp on Cyberus Linux 26.05
Aliases: GHSA-pj89-8hch-p7vp
Packages: libcbor
Status: In Progress
Advisory Information
Impact
When
cbor_stream_decode()returnsCBOR_DECODER_NEDATA, it reports inrequiredthe total number of bytes that must be available before decoding can make progress. This total is computed with asize_taddition that wraps around for very large declared lengths, sorequiredcan be smaller than, or equal to, the number of bytes already provided:
- On all platforms, a byte string or text string with an 8-byte length close to
UINT64_MAX(for example5B FF FF FF FF FF FF FF FF) reportsrequired = 8after 9 bytes were provided.- On platforms with a 32-bit
size_t, 4-byte lengths close toUINT32_MAXalso wrap (for example5A FF FF FF FFreportsrequired = 4after 5 bytes were provided).The documentation tells callers to accumulate at least
requiredbytes and then retry. A client that does this without other limits retries immediately with the same input and never terminates, so a single crafted input causes a denial of service. Clients that userequiredto size buffers receive a wrong value. libcbor itself does not access memory out of bounds.Not affected:
cbor_load()and the other item-based APIs, which returnCBOR_ERR_NOTENOUGHDATAwithout retrying.- Clients that do not use
required.The issue was introduced in 0.8.0 (commit cd36861), when
requiredchanged to report the total number of bytes needed.Patches
Fixed in 0.14.1. Upgrade to 0.14.1 or later.
The fix is commit
07b908bin 0.14.1 and commitb965ec2on master, where it will be part of the next minor release. One change fixes both this advisory and GHSA-frh9-3gqx-pqg2, which share the root cause inclaim_bytes.
requiredis now computed without overflow and saturates atSIZE_MAXwhen the total does not fit intosize_t, which marks a claim that the address space can never satisfy. Clients should still cap how much data they are willing to buffer.Verified on a 32-bit (i386) build: the added regression tests fail against 0.14.0 and pass with the fix, with no other test affected.
A CVE ID has been requested and will be added to this advisory once assigned.
Workarounds
After
CBOR_DECODER_NEDATA, treat arequiredvalue that is not greater than the number of bytes passed tocbor_stream_decode()as an error. A correctrequiredis always greater than that. Also caprequiredat the largest message size your application accepts.
Updates
2026-11-24 15:42 CET
Metadata changes:
- Status for package
libcbor: “In Progress”
2026-11-24 10:54 CET
Metadata changes:
- Status for package
libcbor: “Plausible”
2026-11-24 10:53 CET
Metadata changes:
- Status for package
libcbor: “New”