Hugging Face datasets: Arbitrary code execution via pickle deserialization (CVE-2026-57845)
The Hugging Face 'datasets' library is vulnerable to arbitrary code execution (CVE-2026-57845) due to insecure deserialization of untrusted data via the pandas builder.
CVE search metadata
CVE search record: CVE-2026-57845. KEV: no. Product: datasets (<= 5.1.0). Brief: Hugging Face datasets: Arbitrary code execution via pickle deserialization (CVE-2026-57845). Brief link: https://feed.craftedsignal.io/briefs/2026-10-hugging-face-datasets-pickle-rce/
Triage facts
Revision 1- Applicability
- datasets (<= 5.1.0)
- Evidence
- Unknown
- Severity
- High
- Action
- Elevated
- Sources
- 5 public sources
- Freshness
- Revision 1Oct 23, 03:20 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- B2Likely
A vulnerability (CVE-2026-57845) exists in the Hugging Face datasets library, specifically within the dataset_module_factory pandas-based builder. The library uses pandas.read_pickle() to process data files without proper validation. An attacker can supply a malicious pickle file that executes arbitrary code during the deserialization process when load_dataset() is invoked. The PoC demonstrates successful code execution by triggering a local file write upon loading a malicious pickle object. There is currently no upstream fix, PR, or confirmed patched release.
Attack Chain
- Attacker prepares a malicious pickle object using the
__reduce__()method to embed a payload. - Attacker hosts or supplies the malicious file as an input to the
load_dataset()function. - Victim application invokes
datasets.load_dataset()pointing to the malicious file. - The
dataset_module_factoryidentifies the file and routes it to thepandaspackaged builder. - The builder invokes
pandas.read_pickle()on the untrusted input. - The
picklemodule deserializes the object, triggering the attacker-supplied callable. - Arbitrary code executes within the context of the application process.
Impact
Successful exploitation results in arbitrary code execution on the system running the datasets library. The PoC confirms that code execution occurs before the library attempts to convert the data into an Arrow table, rendering post-deserialization validation ineffective.
Recommendation
- Identify all instances of the Hugging Face
datasetslibrary in production and development environments using automated inventory tools. - Immediately stop using pickle-formatted datasets from untrusted or external sources.
- Migrate all data exchange to secure formats such as Parquet, Arrow, CSV, or JSON.
- If existing data must be moved, use
Dataset.from_pandas()with a trusted, already-loaded DataFrame rather than loading from disk via thepandasbuilder. - Implement strict input validation or access controls to prevent the loading of pickle files from arbitrary or internet-accessible locations.
- Monitor logs for the execution of Python processes that import the
datasetsmodule and perform file operations in untrusted directories.
Immediate actions
Inventory all applications using huggingface/datasets and identify reliance on pickle-based ingestion.
Mitigations
Disable pickle-based dataset loading; switch to Parquet or JSON formats.
CVE-2026-57845