CVE-2025-68131
CBORDecoder reuse can leak shareable values across decode calls
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- Low
- Integrity
- None
- Availability
- Low
Exploit likelihood
What each source reports
CVE List Score used
5.5
CBORDecoder reuse can leak shareable values across decode calls
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
- Record
CVE-2025-68131- CVSS 4.0
- 5.5 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N/E:P - Weakness
- CWE-212
- Updated
- 2026-11-02
EUVDEUVD-2025-205866
5.5
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
- Record
EUVD-2025-205866- CVSS 4.0
- 5.5 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N/E:P - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-wcj4-jw5j-44wh
5.5
CBORDecoder reuse can leak shareable values across decode calls
Summary
When a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries.
Details
The issue is in the decoder's handling of the shareables list, which stores values tagged with CBOR tag 28 (shareable) for later reference by tag 29 (sharedref).
When decode_from_bytes() is called or when .fp is set to a new stream, the shareables list is not cleared. This allows references to persist across separate decode operations.
The issue exists in both the C extension and the pure Python decoder.
In the C extension (source/decoder.c), the _CBORDecoder_set_fp function (line ~202) updates the file pointer but does not reset the shareables state:
static int
_CBORDecoder_set_fp(CBORDecoderObject *self, PyObject *value, void *closure)
{
// ... validation ...
tmp = self->read;
self->read = read;
Py_DECREF(tmp);
return 0;
// Missing: PyList_Clear(self->shareables) or equivalent
}
In the pure Python decoder (cbor2/_decoder.py), the fp setter similarly fails to clear self._shareables.
Similarly, decode_from_bytes() in both implementations saves and restores the read pointer but does not clear the shareables list between decodes.
The shareable/sharedref tags are defined in the CBOR value sharing extension (http://cbor.schmorp.de/value-sharing) with scope limited to a single CBOR data item, not across separate messages.
PoC
import cbor2
from io import BytesIO
# Message from trusted source containing a shareable value
msg1 = cbor2.dumps(cbor2.CBORTag(28, "secret"))
# Attacker-controlled message referencing index 0
msg2 = cbor2.dumps(cbor2.CBORTag(29, 0))
# Decoder reused across trust boundaries
decoder = cbor2.CBORDecoder(BytesIO(b''))
decoder.decode_from_bytes(msg1)
print(decoder.decode_from_bytes(msg2)) # prints "secret"
No special configuration required. Affects any application that reuses a CBORDecoder instance to decode messages from different sources.
Impact
Information disclosure. Applications that reuse a CBORDecoder across trust boundaries are vulnerable if the trusted messages use value sharing (tag 28) and an attacker can send messages containing shared references (tag 29). An attacker who can send a crafted CBOR message containing a sharedref tag can read values from previously decoded messages, potentially exposing sensitive data such as credentials, tokens, or private user data.
Related
A similar issue in the encoder could produce invalid CBOR with dangling shared references:
import cbor2
from io import BytesIO
# Create encoder with value sharing enabled
encoder = cbor2.CBOREncoder(BytesIO(), value_sharing=True)
# Persistent object that will be encoded multiple times
shared_obj = ['hello']
# First encode: array containing shared_obj twice
encoder.encode([shared_obj, shared_obj])
print(f'First encode: {encoder.fp.getvalue().hex()}')
# Output: d81c82d81c816568656c6c6fd81d01
# Second encode: just shared_obj
encoder.fp = BytesIO()
encoder.encode(shared_obj)
result = encoder.fp.getvalue()
print(f'Second encode: {result.hex()}')
# Output: d81d01 (just a shared reference to index 1!)
# Try to decode the second result as standalone CBOR
decoder = cbor2.CBORDecoder(BytesIO(result))
decoded = decoder.decode()
# FAILS: shared reference 1 not found
While primarily a correctness bug, it could cause denial of service if invalid CBOR is transmitted to downstream systems that fail to parse it, or cause silent data corruption if the dangling reference happens to resolve to an unrelated value.
It can also be considered a memory leak in both the decoder and encoder as references are held that will never be released as long as the decoder/encoder remains alive.
###…
- Record
GHSA-wcj4-jw5j-44wh- CVSS 4.0
- 5.5 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N/E:P - Weakness
- CWE-212
- Updated
- 2026-11-02
NVD
5.5
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
- Record
CVE-2025-68131- CVSS 4.0
- 5.5 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N/E:P/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Weakness
- CWE-212
- Updated
- 2026-11-02
OSV
5.5
CBORDecoder reuse can leak shareable values across decode calls
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
- Record
CVE-2025-68131- CVSS 4.0
- 5.5 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N/E:P - Weakness
- CWE-212
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2025-68131
7.5
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
- Record
DEBIAN-CVE-2025-68131- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Updated
- 2026-11-02
Show 8 moreShow less
OSVGHSA-wcj4-jw5j-44wh
5.5
CBORDecoder reuse can leak shareable values across decode calls
Summary
When a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries.
Details
The issue is in the decoder's handling of the shareables list, which stores values tagged with CBOR tag 28 (shareable) for later reference by tag 29 (sharedref).
When decode_from_bytes() is called or when .fp is set to a new stream, the shareables list is not cleared. This allows references to persist across separate decode operations.
The issue exists in both the C extension and the pure Python decoder.
In the C extension (source/decoder.c), the _CBORDecoder_set_fp function (line ~202) updates the file pointer but does not reset the shareables state:
static int
_CBORDecoder_set_fp(CBORDecoderObject *self, PyObject *value, void *closure)
{
// ... validation ...
tmp = self->read;
self->read = read;
Py_DECREF(tmp);
return 0;
// Missing: PyList_Clear(self->shareables) or equivalent
}
In the pure Python decoder (cbor2/_decoder.py), the fp setter similarly fails to clear self._shareables.
Similarly, decode_from_bytes() in both implementations saves and restores the read pointer but does not clear the shareables list between decodes.
The shareable/sharedref tags are defined in the CBOR value sharing extension (http://cbor.schmorp.de/value-sharing) with scope limited to a single CBOR data item, not across separate messages.
PoC
import cbor2
from io import BytesIO
# Message from trusted source containing a shareable value
msg1 = cbor2.dumps(cbor2.CBORTag(28, "secret"))
# Attacker-controlled message referencing index 0
msg2 = cbor2.dumps(cbor2.CBORTag(29, 0))
# Decoder reused across trust boundaries
decoder = cbor2.CBORDecoder(BytesIO(b''))
decoder.decode_from_bytes(msg1)
print(decoder.decode_from_bytes(msg2)) # prints "secret"
No special configuration required. Affects any application that reuses a CBORDecoder instance to decode messages from different sources.
Impact
Information disclosure. Applications that reuse a CBORDecoder across trust boundaries are vulnerable if the trusted messages use value sharing (tag 28) and an attacker can send messages containing shared references (tag 29). An attacker who can send a crafted CBOR message containing a sharedref tag can read values from previously decoded messages, potentially exposing sensitive data such as credentials, tokens, or private user data.
Related
A similar issue in the encoder could produce invalid CBOR with dangling shared references:
import cbor2
from io import BytesIO
# Create encoder with value sharing enabled
encoder = cbor2.CBOREncoder(BytesIO(), value_sharing=True)
# Persistent object that will be encoded multiple times
shared_obj = ['hello']
# First encode: array containing shared_obj twice
encoder.encode([shared_obj, shared_obj])
print(f'First encode: {encoder.fp.getvalue().hex()}')
# Output: d81c82d81c816568656c6c6fd81d01
# Second encode: just shared_obj
encoder.fp = BytesIO()
encoder.encode(shared_obj)
result = encoder.fp.getvalue()
print(f'Second encode: {result.hex()}')
# Output: d81d01 (just a shared reference to index 1!)
# Try to decode the second result as standalone CBOR
decoder = cbor2.CBORDecoder(BytesIO(result))
decoded = decoder.decode()
# FAILS: shared reference 1 not found
While primarily a correctness bug, it could cause denial of service if invalid CBOR is transmitted to downstream systems that fail to parse it, or cause silent data corruption if the dangling reference happens to resolve to an unrelated value.
It can also be considered a memory leak in both the decoder and encoder as references are held that will never be released as long as the decoder/encoder remains alive.
###…
- Record
GHSA-wcj4-jw5j-44wh- CVSS 4.0
- 5.5 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N/E:P - Weakness
- CWE-212
- Updated
- 2026-11-02
OSVPYSEC-2025-90
7.5
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
- Record
PYSEC-2025-90- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Updated
- 2026-11-02
OSVROOT-APP-PYPI-CVE-2025-68131
7.5
CVE-2025-68131 in rootio-cbor2 - Patched by Root
Root has patched CVE-2025-68131 in the rootio-cbor2 package for Root:PyPI. Multiple fixed versions available.
- Record
ROOT-APP-PYPI-CVE-2025-68131- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Updated
- 2026-11-02
OSVUBUNTU-CVE-2025-68131
5.5
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
- Record
UBUNTU-CVE-2025-68131- CVSS 4.0
- 5.5 Medium
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:N/VA:L/SC:N/SI:N/SA:N/E:P - CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N - Updated
- 2026-11-02
OSVAZL-73325 No score
CVE-2025-68131 affecting package python-cbor2 5.6.5-2
cbor2 provides encoding and decoding for the Concise Binary Object Representation (CBOR) serialization format. Starting in version 3.0.0 and prior to version 5.8.0, whhen a CBORDecoder instance is reused across multiple decode operations, values marked with the shareable tag (28) persist in memory and can be accessed by subsequent CBOR messages using the sharedref tag (29). This allows an attacker-controlled message to read data from previously decoded messages if the decoder is reused across trust boundaries. Version 5.8.0 patches the issue.
- Record
AZL-73325- Updated
- 2026-11-05
OSVopenSUSE-SU-2026:10014-1 No score
python311-cbor2-5.8.0-2.1 on GA media
These are all security issues fixed in the python311-cbor2-5.8.0-2.1 package on the GA media of openSUSE Tumbleweed.
- Record
openSUSE-SU-2026:10014-1- Updated
- 2026-11-02
OSVopenSUSE-SU-2026:20468-1 No score
Security update for python-cbor2
This update for python-cbor2 fixes the following issues:
- CVE-2025-68131: CBORDecoder reuse across trust boundaries can lead to leak of shareable values from previous decode calls via attacker-controlled messages (bsc#1255783).
- CVE-2026-26209: uncontrolled recursion via crafted CBOR payloads can cause a denial of service (bsc#1260367).
- Record
openSUSE-SU-2026:20468-1- Updated
- 2026-11-02
OSVSUSE-SU-2026:21139-1 No score
Security update for python-cbor2
This update for python-cbor2 fixes the following issues:
- CVE-2025-68131: CBORDecoder reuse across trust boundaries can lead to leak of shareable values from previous decode calls via attacker-controlled messages (bsc#1255783).
- CVE-2026-26209: uncontrolled recursion via crafted CBOR payloads can cause a denial of service (bsc#1260367).
- Record
SUSE-SU-2026:21139-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
cbor2PyPI |
3.0.0 up to 5.8.0 | 5.8.0 |
python-cbor2Azure Linux:3 |
through 5.6.5-2 | None known |
cbor2Debian:12 |
All versions, plus listed versions 5.4.6-15.4.6-25.5.1-15.6.0-15.6.1-1 Show 15 moreShow less5.6.2-15.6.3-15.6.4-15.6.5-15.7.0-15.7.1-15.8.0-15.8.0-25.8.0-35.9.0-15.9.0-25.9.0-2~bpo13+15.9.0-2~bpo13+26.1.2-16.1.2-2 |
None known |
cbor2Debian:13 |
All versions, plus listed versions 5.6.5-15.7.0-15.7.1-15.8.0-15.8.0-2 Show 7 moreShow less5.8.0-35.9.0-15.9.0-25.9.0-2~bpo13+15.9.0-2~bpo13+26.1.2-16.1.2-2 |
None known |
cbor2Debian:14 |
before 5.8.0-1, plus listed versions 5.6.5-15.7.0-15.7.1-1 |
5.8.0-1 |
cbor2PyPI |
3.0.0 up to 5.8.0, plus listed versions 3.0.13.0.23.0.33.0.44.0.0 Show 30 moreShow less4.0.14.1.04.1.14.1.25.0.05.0.15.1.05.1.15.1.25.2.05.2.0.post15.3.05.4.05.4.15.4.25.4.2.post15.4.35.4.45.4.55.4.65.5.05.5.15.6.05.6.15.6.25.6.35.6.45.6.55.7.05.7.1 |
5.8.0 |
rootio-cbor2Root:PyPI |
before 5.6.5+root.io.1 | 5.6.5+root.io.15.6.5+root.io.25.6.5+root.io.3 |
cbor2Root:PyPI |
before 5.6.5+aikido.3 | 5.6.5+aikido.3 |
python-cbor2SUSE:Linux Enterprise Server 16.0 From an advisory covering 2 CVEs |
before 5.6.5-160000.4.1 | 5.6.5-160000.4.1 |
python-cbor2SUSE:Linux Enterprise Server for SAP applications 16.0 From an advisory covering 2 CVEs |
before 5.6.5-160000.4.1 | 5.6.5-160000.4.1 |
Show 7 moreShow less
| Package | Affected | Fixed |
|---|---|---|
cbor2Ubuntu:22.04:LTS |
All versions, plus listed versions 5.2.0-45.2.0-4build15.4.2-15.4.2-1build1 |
None known |
cbor2Ubuntu:24.04:LTS |
All versions, plus listed versions 5.4.6-25.4.6-2build15.5.1-15.6.0-15.6.1-15.6.2-15.6.2-1build1 |
None known |
cbor2Ubuntu:25.10 |
All versions, plus listed versions 5.6.5-1build1 |
None known |
cbor2Ubuntu:26.10 |
All versions, plus listed versions 5.8.0-2ubuntu16.1.2-2 |
None known |
cbor2Ubuntu:26.04:LTS |
All versions, plus listed versions 5.6.5-1build15.7.0-15.7.1-15.8.0-15.8.0-2ubuntu1 |
None known |
python-cbor2openSUSE:Tumbleweed |
before 5.8.0-2.1 | 5.8.0-2.1 |
python-cbor2openSUSE:Leap 16.0 From an advisory covering 2 CVEs |
before 5.6.5-160000.4.1 | 5.6.5-160000.4.1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected | ||
| facts | OSV | |
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2025-68131 is a medium vulnerability (CVSS 5.5) in Agronholm Cbor2, published December 31, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.46%, the 40th percentile. Fixed in cbor2 5.8.0.
References
github.com/agronholm/cbor2/security/advisories/GHSA-wcj4-jw5j-44wh
github.com/agronholm/cbor2/pull/268
nvd.nist.gov/vuln/detail/CVE-2025-68131
github.com/agronholm/cbor2/commit/f1d701cd2c411ee40bb1fe383afe7f365f35abf0
github.com/pypa/advisory-database/tree/main/vulns/cbor2/PYSEC-2025-90.yaml
github.com/advisories/GHSA-wcj4-jw5j-44wh
Show 10 moreShow less
github.com/CVEProject/cvelistV5/tree/main/cves/2025/68xxx/CVE-2025-68131.json
security-tracker.debian.org/tracker/CVE-2025-68131
github.com/agronholm/cbor2
suse.com/support/update/announcement/2026/suse-su-202621139-1
bugzilla.suse.com/1255783
bugzilla.suse.com/1260367
suse.com/security/cve/CVE-2025-68131
suse.com/security/cve/CVE-2026-26209
ubuntu.com/security/CVE-2025-68131
cve.org/CVERecord?id=CVE-2025-68131
Left out here: the rest of 2 source descriptions. The JSON record has them.