VAITP Dataset

← Back to the dataset

CVE-2026-57845

Insecure deserialization in Hugging Face Datasets lets malicious pickles run arbitrary Python code.

  • CVSS 8.7
  • CWE-502
  • Input Validation and Sanitization
  • Remote

Hugging Face Datasets through 5.1.0 contains an insecure deserialization vulnerability that allows attackers to execute arbitrary Python code by crafting a malicious pickle file loaded through the deprecated pandas packaged builder. Attackers can supply a pickle-backed dataset that is processed by Pandas._generate_tables via pandas.read_pickle() without validation, so when a victim calls datasets.load_dataset("pandas", data_files=…), the embedded __reduce__ payload executes code with the victim process's privileges.

CVSS base score
8.7
Published
2026-10-23
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Timing/Serialization
Code defect classification
Serialization Issues
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
datasets
Fixed by upgrading
Yes

Solution

Upgrade the huggingface‑datasets package to version 5.2.0 or later, which removes the vulnerable pandas builder and fixes the insecure deserialization issue.

Vulnerable code sample

import pandas as pd

def load_pandas_dataset(file_path: str):
    # VULNERABLE: directly deserializes untrusted pickle
    df = pd.read_pickle(file_path)
    return df

Patched code sample

import pandas as pd

def load_pandas_dataset(file_path: str):
    # FIX: reject pickle files and use safe CSV parsing
    if file_path.lower().endswith(('.pkl', '.pickle')):
        raise ValueError("Pickle files are not allowed")
    df = pd.read_csv(file_path)
    return df

Published fix

Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.

Cite this entry

@misc{vaitp:cve202657845,
  title        = {{Insecure deserialization in Hugging Face Datasets lets malicious pickles run arbitrary Python code.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-57845},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-57845/}}
}

Download this entry as JSON Download the whole dataset

Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.