Skip to content

Security: Address diskcache pickle deserialization vulnerability (CVE-2025-69872) #19

@jm-rivera

Description

@jm-rivera

Summary

diskcache (<= 5.6.3, which is the latest release) has a known vulnerability (CVE-2025-69872 / GHSA-w8v5-vhqr-4h9v) related to unsafe pickle deserialization. An attacker with write access to the cache directory can craft a malicious pickle payload that executes arbitrary code when the cache is read.

imf-reader uses diskcache with the default pickle serializer to cache IMF API responses at ~/.cache/imf_reader/weo/.

Upstream status

The diskcache maintainer has not responded to the CVE report (grantjenks/python-diskcache#357) or reviewed the partial mitigation PR (#359). The last commit to diskcache was August 2023, and there are 70+ open issues. The project appears effectively unmaintained for security purposes.

There is no patched version of diskcache available.

Practical risk

The practical risk for imf-reader is low — the cache is in the user's home directory, the data comes from a trusted public API, and an attacker with home directory write access likely has more direct attack vectors. However, this CVE causes security scanners to flag any project that transitively depends on diskcache, which creates compliance issues for downstream consumers like pydeflate.

Possible approaches

  1. Switch to JSONDisk serializer for codelist/dict caching (JSON-safe data). This is what Fedora's downstream patch does. DataFrame caching would need an alternative approach (e.g., parquet via pyarrow).

  2. Make diskcache an optional dependency — this is what projects like FastMCP and Instructor have done. Caching would only be available when the user explicitly installs diskcache.

  3. Replace diskcache with an alternative — e.g., joblib (common in data science), dogpile.cache, or a simple SQLite + JSON/parquet approach.

  4. Pin and document the accepted risk until upstream resolves the issue.

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions