CVE-2025-48071: OpenEXR OpenEXR Heap-Based Buffer Overflow Vulnerability

HIGH
Advisory Identifier: GHSA-h45x-qhg2-q375
CVSS 7.8
CWE-122
Published
Advisory Summary

CVE-2025-48071 is a HIGH (CVSS 7.8) openexr heap-based buffer overflow vulnerability (CWE-122: Heap-based Buffer Overflow) affecting OpenEXR libraries in the PyPI ecosystem. The issue involves openexr heap-based buffer overflow in deep scanline parsing via forged unpacked size. Remediation is available by upgrading affected packages to version 3.3.3.

CVE-2025-48071 at a Glance

CVE Identifier CVE-2025-48071
GHSA Identifier GHSA-h45x-qhg2-q375
Severity HIGH
CVSS v3.1 Base Score 7.8
CWE Classification CWE-122: Heap-based 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-48071

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.3.3
pip install OpenEXR>=3.3.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-48071, 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.3.3), 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-122: Heap-based Buffer Overflow, where a heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc(). 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 The OpenEXRCore code is vulnerable to a heap-based buffer overflow during a write operation when decompressing ZIPS-packed deep scan-line EXR files with a maliciously forged chunk header. ### Details When parsing `STORAGE_DEEP_SCANLINE` chunks from an EXR file, the following code (from `src/lib/OpenEXRCore/chunk.c`) is used to extract the chunk information: ```cpp if (part->storage_mode == EXR_STORAGE_DEEP_SCANLINE) // SNIP... cinfo->sample_count_data_offset = dataoff; cinfo->sample_count_table_size = (uint64_t) ddata[0]; cinfo->data_offset = dataoff + (uint64_t) ddata[0]; cinfo->packed_size = (uint64_t) ddata[1]; cinfo->unpacked_size = (uint64_t) ddata[2]; // SNIP... ``` By storing this information, the code that will later decompress and reconstruct the chunk bytes, will know how much space the uncompressed data will occupy. This size is carried along in the chain of decoding/decompression until the `undo_zip_impl` function in `src/lib/OpenEXRCore/internal_zip.c`: ```cpp static exr_result_t undo_zip_impl ( exr_decode_pipeline_t* decode, const void* compressed_data, uint64_t comp_buf_size, void* uncompressed_data, uint64_t uncompressed_size, void* scratch_data, uint64_t scratch_size) { size_t actual_out_bytes; exr_result_t res; if (scratch_size < uncompressed_size) return EXR_ERR_INVALID_ARGUMENT; res = exr_uncompress_buffer ( decode->context, compressed_data, comp_buf_size, scratch_data, scratch_size, &actual_out_bytes); if (res == EXR_ERR_SUCCESS) { decode->bytes_decompressed = actual_out_bytes; if (comp_buf_size > actual_out_bytes) res = EXR_ERR_CORRUPT_CHUNK; else internal_zip_reconstruct_bytes ( uncompressed_data, scratch_data, actual_out_bytes); } return res; } ``` The `uncompressed_size` comes from the `unpacked_size` extracted earlier, and the `uncompressed_data` is a buffer allocated by making space for the size "advertised" in the chunk information. However, `scratch_data` and `actual_out_bytes` will contain, after decompression, the uncompressed data and its size, respectively. The vulnerability lies in the fact that the `undo_zip_impl` function lacks code to check whether `actual_out_bytes` is greater than `uncompressed_size`. The effect is that, by setting the `unpacked_size` in the chunk header smaller than the actual chunk decompressed data, it is possible - in the `internal_zip_reconstruct_bytes` function - to overflow past the boundaries of a heap chunk. ### PoC NOTE: you can download the `heap_overflow.exr` file from this link: https://github.com/ShielderSec/poc/tree/main/CVE-2025-48071 1. Compile the `exrcheck` binary in a macOS or GNU/Linux machine with ASAN. 2. Open the `heap_overflow.exr` file with the following command: ``` exrcheck heap_overflow.exr ``` 3. Notice that `exrcheck` crashes with an ASAN stack-trace. ![image](https://github.com/user-attachments/assets/57907073-bc9f-40bb-9030-16008035ade8) ### Impact An attacker might exploit this vulnerability by feeding a maliciously crafted file to a program that uses the OpenEXR libraries, thus gaining the capability to write an arbitrary amount of bytes in the heap. This could potentially result in code execution in the process.

CVE-2025-48071 Affected OpenEXR Versions

1 component(s)
Fixed Versions:
3.3.3
Product / Package Ecosystem Affected Versions Fixed Version
OpenEXR
PyPI
≥ 3.3.0
< 3.3.3
3.3.3

References

Frequently Asked Questions

What is CVE-2025-48071?
CVE-2025-48071 is a security vulnerability in OpenEXR involving OpenEXR Heap-Based Buffer Overflow in Deep Scanline Parsing via Forged Unpacked Size under CWE-122: Heap-based Buffer Overflow.
Which OpenEXR versions are affected?
Affected versions include releases prior to 3.3.3 across affected packages: OpenEXR.
What version fixes CVE-2025-48071?
Upgrading to 3.3.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.3.3. Upgrade your dependency to 3.3.3 or later.
What is the CVSS score of CVE-2025-48071?
CVE-2025-48071 has a CVSS v3.1 base score of 7.8 (HIGH) 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-48071?
CVE-2025-48071 is classified under CWE-122: Heap-based Buffer Overflow (A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().).
How can I check PyPI dependencies for CVE-2025-48071?
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-h45x-qhg2-q375",
  "modified" : "2025-08-13T21:37:55Z",
  "published" : "2025-07-31T19:12:56Z",
  "aliases" : [ "CVE-2025-48071" ],
  "summary" : "OpenEXR Heap-Based Buffer Overflow in Deep Scanline Parsing via Forged Unpacked Size",
  "details" : "### Summary\n\nThe OpenEXRCore code is vulnerable to a heap-based buffer overflow during a write operation when decompressing ZIPS-packed deep scan-line EXR files with a maliciously forged chunk header.\n\n### Details\nWhen parsing `STORAGE_DEEP_SCANLINE` chunks from an EXR file, the following code (from `src/lib/OpenEXRCore/chunk.c`) is used to extract the chunk information:\n\n```cpp\n\nif (part->storage_mode == EXR_STORAGE_DEEP_SCANLINE)\n// SNIP...\n        cinfo->sample_count_data_offset = dataoff;\n        cinfo->sample_count_table_size  = (uint64_t) ddata[0];\n        cinfo->data_offset              = dataoff + (uint64_t) ddata[0];\n        cinfo->packed_size              = (uint64_t) ddata[1];\n        cinfo->unpacked_size            = (uint64_t) ddata[2];\n// SNIP...\n```\n\nBy storing this information, the code that will later decompress and reconstruct the chunk bytes, will know how much space the uncompressed data will occupy.\n\nThis size is carried along in the chain of decoding/decompression until the `undo_zip_impl` function in `src/lib/OpenEXRCore/internal_zip.c`:\n\n```cpp\nstatic exr_result_t\nundo_zip_impl (\n    exr_decode_pipeline_t* decode,\n    const void*            compressed_data,\n    uint64_t               comp_buf_size,\n    void*                  uncompressed_data,\n    uint64_t               uncompressed_size,\n    void*                  scratch_data,\n    uint64_t               scratch_size)\n{\n    size_t       actual_out_bytes;\n    exr_result_t res;\n\n    if (scratch_size < uncompressed_size) return EXR_ERR_INVALID_ARGUMENT;\n\n    res = exr_uncompress_buffer (\n        decode->context,\n        compressed_data,\n        comp_buf_size,\n        scratch_data,\n        scratch_size,\n        &actual_out_bytes);\n\n    if (res == EXR_ERR_SUCCESS)\n    {\n        decode->bytes_decompressed = actual_out_bytes;\n        if (comp_buf_size > actual_out_bytes)\n            res = EXR_ERR_CORRUPT_CHUNK;\n        else\n            internal_zip_reconstruct_bytes (\n                uncompressed_data, scratch_data, actual_out_bytes);\n    }\n\n    return res;\n}\n```\n\nThe `uncompressed_size` comes from the `unpacked_size` extracted earlier, and the `uncompressed_data` is a buffer allocated by making space for the size \"advertised\" in the chunk information.\n\nHowever, `scratch_data` and `actual_out_bytes` will contain, after decompression, the uncompressed data and its size, respectively. \n\nThe vulnerability lies in the fact that the `undo_zip_impl` function lacks code to check whether `actual_out_bytes` is greater than `uncompressed_size`. \n\nThe effect is that, by setting the `unpacked_size` in the chunk header smaller than the actual chunk decompressed data, it is possible - in the `internal_zip_reconstruct_bytes` function - to overflow past the boundaries of a heap chunk.\n\n### PoC\n\nNOTE: you can download the `heap_overflow.exr` file from this link:\n\nhttps://github.com/ShielderSec/poc/tree/main/CVE-2025-48071\n\n1. Compile the `exrcheck` binary in a macOS or GNU/Linux machine with ASAN.\n2. Open the `heap_overflow.exr` file with the following command:\n\n```\nexrcheck heap_overflow.exr\n```\n\n3. Notice that `exrcheck` crashes with an ASAN stack-trace.\n![image](https://github.com/user-attachments/assets/57907073-bc9f-40bb-9030-16008035ade8)\n\n### Impact\n\nAn attacker might exploit this vulnerability by feeding a maliciously crafted file to a program that uses the OpenEXR libraries, thus gaining the capability to write an arbitrary amount of bytes in the heap. This could potentially result in code execution in the process.",
  "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:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "OpenEXR"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.3.0"
      }, {
        "fixed" : "3.3.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/AcademySoftwareFoundation/openexr/security/advisories/GHSA-h45x-qhg2-q375"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-48071"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/AcademySoftwareFoundation/openexr/commit/916cc729e24aa16b86d82813f6e136340ab2876f"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/AcademySoftwareFoundation/openexr"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/AcademySoftwareFoundation/openexr/releases/tag/v3.3.3"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/ShielderSec/poc/tree/main/CVE-2025-48071"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-122" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-07-31T19:12:56Z",
    "nvd_published_at" : "2025-07-31T21:15:27Z"
  }
}