CVE-2025-66019: Pypdf Pypdf's LZWDecode Streams Be Manipulated Vulnerability

MODERATE
Advisory Identifier: GHSA-m449-cwjh-6pw7
CWE-409 CWE-400
Published
Advisory Summary

CVE-2025-66019 is a MODERATE pypdf's lzwdecode streams be manipulated vulnerability (CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)) affecting Pypdf libraries in the PyPI ecosystem. The issue involves pypdf's lzwdecode streams be manipulated to exhaust ram. Remediation is available by upgrading affected packages to version 6.4.0.

CVE-2025-66019 at a Glance

CVE Identifier CVE-2025-66019
GHSA Identifier GHSA-m449-cwjh-6pw7
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-409: Improper Handling of Highly Compressed Data (Data Amplification)
Affected Product Pypdf
Package Ecosystem PyPI
Published Date
Last Updated

How to Fix CVE-2025-66019

To remediate this vulnerability, upgrade all affected Pypdf dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

pypdf fixed: 6.4.0
pip install pypdf>=6.4.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show pypdf

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2025-66019, inspect your installed packages using pip:

pip show pypdf

Analyze the terminal output to locate any version of Pypdf in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 6.4.0), your application is affected.

Note: The pip show pypdf command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-409: Improper Handling of Highly Compressed Data (Data Amplification), where the product does not handle or incorrectly handles a compressed input with a very high compression ratio that produces a large output. In Pypdf, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Impact An attacker who uses this vulnerability can craft a PDF which leads to a memory usage of up to 1 GB per stream. This requires parsing the content stream of a page using the LZWDecode filter. This is a follow up to [GHSA-jfx9-29x2-rv3j](https://github.com/py-pdf/pypdf/security/advisories/GHSA-jfx9-29x2-rv3j) to align the default limit with the one for *zlib*. ### Patches This has been fixed in [pypdf==6.4.0](https://github.com/py-pdf/pypdf/releases/tag/6.4.0). ### Workarounds If users cannot upgrade yet, use the line below to overwrite the default in their code: ```python pypdf.filters.LZW_MAX_OUTPUT_LENGTH = 75_000_000 ```

CVE-2025-66019 Affected Pypdf Versions

1 component(s)
Fixed Versions:
6.4.0
Product / Package Ecosystem Affected Versions Fixed Version
pypdf
PyPI
< 6.4.0
6.4.0

References

Frequently Asked Questions

What is CVE-2025-66019?
CVE-2025-66019 is a security vulnerability in Pypdf involving pypdf's LZWDecode streams be manipulated to exhaust RAM under CWE-409: Improper Handling of Highly Compressed Data (Data Amplification).
Which Pypdf versions are affected?
Affected versions include releases prior to 6.4.0 across affected packages: pypdf.
What version fixes CVE-2025-66019?
Upgrading to 6.4.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pypdf affected?
Yes, pypdf is affected in releases prior to 6.4.0. Upgrade your dependency to 6.4.0 or later.
What CWE is associated with CVE-2025-66019?
CVE-2025-66019 is classified under CWE-409: Improper Handling of Highly Compressed Data (Data Amplification) (The product does not handle or incorrectly handles a compressed input with a very high compression ratio that produces a large output.).
How can I check PyPI dependencies for CVE-2025-66019?
Run the dependency tree command: 'pip show pypdf'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m449-cwjh-6pw7",
  "modified" : "2026-01-21T16:37:13Z",
  "published" : "2025-11-24T22:42:07Z",
  "aliases" : [ "CVE-2025-66019" ],
  "summary" : "pypdf's LZWDecode streams be manipulated to exhaust RAM",
  "details" : "### Impact\n\nAn attacker who uses this vulnerability can craft a PDF which leads to a memory usage of up to 1 GB per stream. This requires parsing the content stream of a page using the LZWDecode filter.\n\nThis is a follow up to [GHSA-jfx9-29x2-rv3j](https://github.com/py-pdf/pypdf/security/advisories/GHSA-jfx9-29x2-rv3j) to align the default limit with the one for *zlib*.\n\n### Patches\nThis has been fixed in [pypdf==6.4.0](https://github.com/py-pdf/pypdf/releases/tag/6.4.0).\n\n### Workarounds\nIf users cannot upgrade yet, use the line below to overwrite the default in their code:\n\n```python\npypdf.filters.LZW_MAX_OUTPUT_LENGTH = 75_000_000\n```",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N/E:U"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pypdf"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "6.4.0"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/py-pdf/pypdf/security/advisories/GHSA-jfx9-29x2-rv3j"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/py-pdf/pypdf/security/advisories/GHSA-m449-cwjh-6pw7"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-66019"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/py-pdf/pypdf/commit/96186725e5e6f237129a58a97cd19204a9ce40b2"
  }, {
    "type" : "WEB",
    "url" : "https://aydinnyunus.github.io/2025/12/20/cve-2025-66019-pypdf-lzw-dos"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/py-pdf/pypdf"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/py-pdf/pypdf/releases/tag/6.4.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-400", "CWE-409" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-11-24T22:42:07Z",
    "nvd_published_at" : "2025-11-26T00:15:51Z"
  }
}