Skip to content
RCE Write-up Intermediate

Loading a Dataset Should Not Run Code

A saved ytdata file's con_args attribute was passed to eval(), so a malicious file could run arbitrary Python code when loaded. An attacker could achieve code execution by tricking a victim into loading a crafted dataset.

Dilanka Kaushal Hewage Follow

Published on r3vpwnx.medium.com

Astrophysics

Dilanka Kaushal Hewage (r3vpwnx), on r3vpwnx.medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 3 min read.

Context

yt is the analysis and visualisation toolkit for volumetric and mesh data, widely used in astrophysics and other simulation-driven fields. One of its conveniences is that a derived dataset can be saved and loaded back later: the ytdata frontend writes the dataset and its parameters into an HDF5 file, and yt.load() reconstructs it.

The feature exists so that results can be shared: intermediate results passed between collaborators, attached to a reproducibility archive, or downloaded from a project page. Loading such a file with yt.load() is meant to look like opening data, not running code.

From the original on r3vpwnx.medium.com

The issue described here is tracked as CVE-2026-132751 and classified as CWE-95, eval injection.

Setup

The affected versions run through 4.4.4. The fixed release is given in the CVE record rather than in the write-up itself. No special account, role or tooling is described: the precondition is simply the ability to produce a ytdata .h5 file that a victim will later load, which is exactly what the sharing workflow invites.

Finding it

The problem sits in the reconstruction path. In yt/frontends/ytdata/data_structures.py, SavedDataset._parse_parameter_file() restores the saved parameters from the HDF5 file. One of those parameters, con_args, is passed to eval().

con_args is stored data, so it comes from whoever wrote the file. That mismatch is what made the code look wrong: a value read back from a file is being handed to a function whose whole purpose is to execute Python.

Exploitation

Step 1: craft a ytdata file with a payload in con_args

A ytdata .h5 whose con_args attribute holds a Python payload instead of the expected value is the entire weaponisation. The write-up does not reproduce a sample payload, so the exact contents are not shown here; the mechanism is that the attribute value is Python source rather than the data the loader expects.

Step 2: get the file loaded

The file is delivered through the normal sharing channels: passed between collaborators, attached to a reproducibility archive, or downloaded from a project page. The victim then loads it with yt.load().

Step 3: code runs on load

During reconstruction, SavedDataset._parse_parameter_file() reads con_args from the HDF5 file and passes it to eval().

Root cause

eval() is applied to a stored attribute. Because con_args is written by whoever authored the file, the loader executes that author's code. The write-up frames the lesson directly: con_args is a value, and a value read from a file should be parsed, validated or deserialised with something that cannot execute. eval() on a stored attribute turns "open this dataset" into "run this dataset's author's code".

Impact

A ytdata .h5 whose con_args holds a Python payload runs that payload when the file is loaded with yt.load(). The conditions are the ordinary ones of the sharing workflow: the file has to reach the victim and the victim has to load it.

Fix

The report points to the CVE record for the fixed release. The write-up does not describe the patch itself. The lesson it draws is that con_args is a value, and a value read from a file should be parsed, validated or deserialised with something that cannot execute.

Variants to test

  1. A positive result is a saved file whose modified attribute runs code on load.
  2. A positive result is code execution from a file that only looks like data.

CVE record: https://www.cve.org/CVERecord?id=CVE-2026-132751

Write-up: https://r3vpwnx.space/research/yt-ytdata-con-args-rce

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 8 min read.

What happened, in plain words

A scientific software package called yt lets researchers save a dataset to a file and open it again later. That is a normal, useful feature: you do some heavy analysis, save the result, and share the file with a colleague or put it in an archive so others can reproduce your work.

The problem is that when yt opens one of these saved files, one stored parameter, con_args, is passed to eval(). For one particular stored setting, called con_args, it takes the text from the file and runs it as Python code. So a file that looks like data can actually contain instructions, and those instructions run on the computer of whoever opens the file.

This is tracked as CVE-2026-132751 and classified as CWE-95, eval injection. The affected versions run through 4.4.4; the CVE record names the fixed release.

A useful everyday comparison: imagine a recipe card that says "add two cups of flour". Normally you read it and follow it. Now imagine a card that, instead of a quantity, contains a sentence like "go and unlock the front door". If your kitchen assistant treats every card as a set of instructions rather than as a list of ingredients, the card can make them do things you never intended. That is what happens here: a stored value is treated as instructions.

The product and the feature

yt is an analysis and visualisation toolkit for volumetric and mesh data, widely used in astrophysics and other simulation-driven fields. In plain terms, it is software that scientists use to crunch and draw pictures of large simulated datasets, such as models of galaxies or fluids.

One of its conveniences is that a derived dataset can be saved and loaded back later. The part of yt that handles this is called the ytdata frontend. It writes the dataset and its parameters into an HDF5 file, and yt.load() reconstructs it.

Two terms to unpack:

  • Frontend: the part of a program that deals with a particular input format. The ytdata frontend is the part that knows how to read and write yt's own saved-dataset files.
  • HDF5: a file format for storing large amounts of structured data, a bit like a very capable spreadsheet file. It holds named values, called attributes, alongside the main data. A ytdata file is an HDF5 file, usually with the extension .h5.

The feature exists so that results can be shared: intermediate results passed between collaborators, attached to a reproducibility archive, or downloaded from a project page. Loading such a file with yt.load() is meant to look like opening data, not running code. That expectation is the heart of the story.

From the original on r3vpwnx.medium.com

Setup

The affected versions run through 4.4.4. The fixed release is given in the CVE record rather than in the write-up itself.

No special account, role or tooling is described. The precondition is simply the ability to produce a ytdata .h5 file that a victim will later load, which is exactly what the sharing workflow invites. In other words, you do not need to break into anything: you need to make a file and get someone to open it, the same way you would share any research output.

Finding it

The problem sits in the reconstruction path, meaning the code that runs when a saved file is opened and turned back into a dataset. In yt/frontends/ytdata/data_structures.py, SavedDataset._parse_parameter_file() restores the saved parameters from the HDF5 file. One of those parameters, con_args, is passed to eval().

What those pieces mean:

  • yt/frontends/ytdata/data_structures.py: a file in yt's source code. The slashes describe folders, so this is the data_structures.py file inside yt, then frontends, then ytdata.
  • SavedDataset._parse_parameter_file(): a function, a named block of code. SavedDataset is the class (a blueprint for an object) that represents a saved dataset, and _parse_parameter_file() is one of its methods (a function belonging to that class). Its job is to read the parameters out of the saved file.
  • eval(): a built-in Python function that takes a piece of text and runs it as Python code. If you hand it 2 + 2, it gives you 4. If you hand it something more elaborate, it does that too. It does not care whether the text came from a programmer or from a file.

con_args is stored data, so it comes from whoever wrote the file. That mismatch is what made the code look wrong: a value read back from a file is being handed to a function whose whole purpose is to execute Python.

Exploitation

Step 1: craft a ytdata file with a payload in con_args

A ytdata .h5 whose con_args attribute holds a Python payload instead of the expected value is the entire weaponisation. A payload here simply means the code the attacker wants to run.

The write-up does not reproduce a sample payload, so the exact contents are not shown here. The mechanism is that the attribute value is Python source rather than the data the loader expects. Think of it as editing one cell of a spreadsheet so that, instead of a number, it contains a sentence, and the program that opens the spreadsheet reads that sentence aloud as a command.

Step 2: get the file loaded

The file is delivered through the normal sharing channels: passed between collaborators, attached to a reproducibility archive, or downloaded from a project page. The victim then loads it with yt.load().

This step matters because it shows why the bug is realistic rather than theoretical. Nobody has to be tricked into running a suspicious program. They are doing exactly what the feature was designed for: opening a dataset a colleague or a project page gave them.

Step 3: code runs on load

During reconstruction, SavedDataset._parse_parameter_file() reads con_args from the HDF5 file and passes it to eval(). The payload runs in the context of the process doing the loading.

"In the context of the process" means the code runs with the same permissions as the program that opened the file. If the researcher's Python session can read their files, so can the payload.

Root cause

eval() is applied to a stored attribute. Because con_args is written by whoever authored the file, the loader executes that author's code. The write-up frames the lesson directly: con_args is a value, and a value read from a file should be parsed, validated or deserialised with something that cannot execute. eval() on a stored attribute turns "open this dataset" into "run this dataset's author's code".

A few of those words deserve a plain explanation:

  • Parsed: read and interpreted according to a strict format, so that anything not matching the format is rejected. Parsing a number means accepting digits and refusing a sentence.
  • Validated: checked against a list of allowed values or shapes before being used.
  • Deserialised: turned from a stored form back into an in-memory object. Safe deserialisation uses formats that can only represent data, never instructions.

Nothing in the described path distinguishes trusted from untrusted files, which is why the existing expectation that loading data is safe did not hold.

Impact

An attacker who can supply a ytdata .h5 file gets arbitrary code execution in the process of anyone who loads it with yt.load(). Arbitrary code execution means the attacker's code runs as part of the program that opened the file.

The conditions are the ordinary ones of the sharing workflow: the file has to reach the victim and the victim has to load it.

Fix

The report points to the CVE record for the fixed release. The write-up does not describe the patch itself. The lesson it draws is that con_args is a value, and a value read from a file should be parsed, validated or deserialised with something that cannot execute.

In everyday terms: the loader should treat the contents of the file as ingredients, not as instructions. If the value is supposed to be a list of numbers, read it as a list of numbers and refuse anything else.

Variants to test

These are directions for further research, useful if you want to look for similar bugs yourself. Each one describes what to look at and what a positive result would look like.

  1. A positive result is a saved file whose modified attribute runs code on load.
  2. A positive result is code execution from a file that only looks like data.

A sink is the place in a program where untrusted input finally gets used in a dangerous way, such as being executed. Pickle is Python's built-in way of saving objects to a file, and it is known to be able to run code when loading untrusted data. YAML is a human-friendly text format for configuration; some YAML loaders can also construct objects and run code, which is why safer loaders exist. exec is like eval() but for whole blocks of statements rather than a single expression.

CVE record: https://www.cve.org/CVERecord?id=CVE-2026-132751

Write-up: https://r3vpwnx.space/research/yt-ytdata-con-args-rce

Glossary

  • Arbitrary code execution: a situation where an attacker can make a program run code of their choosing.
  • Attribute: a named value stored inside a file or object, such as con_args inside an HDF5 file.
  • Class: a blueprint in Python that describes what an object holds and what it can do.
  • con_args: the stored parameter in a ytdata file that was passed to eval().
  • CVE: a public identifier for a known security vulnerability, here CVE-2026-132751.
  • CWE-95: the category "eval injection", meaning untrusted input reaches code that evaluates it.
  • Deserialise: turn stored data back into an in-memory object; safe deserialisation cannot execute code.
  • eval(): a Python function that runs a piece of text as Python code.
  • exec: a Python function that runs a block of text as Python statements.
  • Frontend: the part of a program that handles a particular input format, here ytdata files.
  • Function: a named block of code that performs a task.
  • HDF5: a file format for large structured datasets, holding data plus named attributes; ytdata files are HDF5 files.
  • Method: a function that belongs to a class.
  • Parse: read text according to a strict format and reject anything that does not match.
  • Payload: the code an attacker wants to have executed.
  • Pickle: Python's built-in object serialisation format, which can execute code when loading untrusted data.
  • Process: a running program; code executed in its context has the same permissions as the program.
  • Sink: the place where untrusted input is finally used dangerously, such as being executed.
  • Validate: check a value against allowed values or shapes before using it.
  • YAML: a text format for configuration data; some loaders can construct objects and run code.
  • yt: an analysis and visualisation toolkit for volumetric and mesh data, used in astrophysics and simulation work.
  • ytdata: yt's own saved-dataset format, written to an HDF5 file and reopened with yt.load().
  • yt.load(): the yt function that opens a saved dataset.

More by Dilanka Kaushal Hewage

View all

5 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Remote code execution

The lesson behind this report.

Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.