pypi package report

Is msgpack safe?

2 known vulnerabilities, worst severity HIGH.

// reach

0 direct dependencies

none carry a known advisory

    196 packages depend on it

    an advisory here reaches each of them

    Create a free accountfor every dependency path, dependent and what to upgrade
    // ai model usage

    No published models are known to use this package.


    cvss
    7.5
    high

    CVSS v3.1 base score out of 10

    epss
    0.54%
    medium

    chance of exploitation in 30 days, 46th percentile of all CVEs

    xyz score
    4.7
    medium

    CyberXYZ composite out of 10

    fig. 01 — GHSA-j586-36cw-2gc2, the advisory selected below

    // 2 advisories

    GHSA-j586-36cw-2gc2

    HIGHGitHub ratingCVE-2026-114613
    // impact

    The msgpack-python C extension (msgpack._cmsgpack) leaks a decoded map value when deserialization rejects a key with strict_map_key=True (the default). Repeated malformed inputs can cause unbounded process memory growth and denial of service in applications that deserialize attacker-controlled MessagePack data. Both unpackb() and the streaming Unpacker API are affected. The pure-Python fallback does not exhibit this leak in the reported tests.

    The report measured approximately 4 MiB retained per failed parse and 100 MiB after 25 failed parses on Windows with Python 3.14 and msgpack 1.2.2. These are reporter-provided results.

    // additional impact: stale parser-stack references

    The reference-ownership audit performed while fixing this leak found an additional memory-safety issue in the streaming Unpacker.

    After unpack() completed a nested container, an inactive parser-stack slot could retain a non-owning pointer to the decoded object. A subsequent skip() could reactivate that slot. If parsing then failed, context cleanup treated the stale pointer as an owned reference and decremented it.

    This corrupts the object's reference count and can result in a use-after-free or double Py_DECREF when its actual owners later release it.

    Although few users use this API, but those who do may experience crashes or unexpected errors due to a use-after-free.

    // details

    In msgpack/unpack.h, unpack_callback_map_item() rejects keys that are neither str nor bytes. At this point the map value has already been constructed. The early error return does not release the value reference.

    In msgpack/unpack_template.h, the value is held in the local obj in unpack_execute(). The CT_MAP_VALUE error path jumps to _failed without decrementing that reference. Cleanup of the parser stack does not recover the value because it is not stored in the stack. The fallback checks the key before decoding the value.

    // affected versions

    The report reproduces the issue on 1.2.2 and reports it on development commit 475c1b7. The affected-product field lists the reproduced release only; it is not a claim that earlier releases are unaffected.

    The earliest affected release needs confirmation: the report's summary says 1.1.x through 1.2.2, while its root-cause analysis attributes introduction to commit cd81370 (PR #673). Resolve this discrepancy before publishing a definitive affected-version range.

    // reproduction

    Run in a disposable local process with the C extension installed:

    import msgpack
    
    payload = msgpack.packb({42: b"A" * (4 * 1024 * 1024)}, use_bin_type=True)
    msgpack.unpackb(payload)  # Raises ValueError; the report observes a 4 MiB leak.

    Streaming API trigger:

    import msgpack
    
    payload = msgpack.packb({42: b"A" * (4 * 1024 * 1024)}, use_bin_type=True)
    u = msgpack.Unpacker()
    u.feed(payload)
    list(u)  # Same strict_map_key error path.
    // workarounds

    The pure-Python fallback is reported not to leak on this path and may be used as a temporary workaround after application compatibility and performance checks. Request-size and rate limits may reduce the impact but do not eliminate cumulative leakage.

    // cvss v3.1 vector

    CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

    Attack vector
    Network
    Attack complexity
    Low
    Privileges required
    None
    User interaction
    None
    Scope
    Unchanged
    Confidentiality
    None
    Integrity
    None
    Availability
    High

    Checked 2026-11-06 at 23:40 UTC. The most recent advisory here was published 2026-10-27. Updated continuously from NVD, GHSA, OSV and CNA feeds.

    Think a verdict here is wrong? Tell us — we respond within 2 business days.