CVE-2026-1839

A vulnerability in the HuggingFace Transformers library, specifically in the `Trainer` class, allows for arbitrary code execution. The `_load_rng_state()` method in `src/transformers/trainer.py` at line 3059 calls `torch.load()` without the `weights_only=True` parameter. This issue affects all versions of the library supporting `torch>=2.2` when used with PyTorch versions below 2.6, as the `safe_globals()` context manager provides no protection in these versions. An attacker can exploit this vulnerability by supplying a malicious checkpoint file, such as `rng_state.pth`, which can execute arbitrary code when loaded. The issue is resolved in version v5.0.0rc3.
Configurations

Configuration 1 (hide)

OR cpe:2.3:a:huggingface:transformers:*:*:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:5.0.0:rc0:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:5.0.0:rc1:*:*:*:*:*:*
cpe:2.3:a:huggingface:transformers:5.0.0:rc2:*:*:*:*:*:*

History

26 Oct 2026, 22:10

Type Values Removed Values Added
Summary
  • (es) Una vulnerabilidad en la biblioteca HuggingFace Transformers, específicamente en la clase “Trainer”, permite la ejecución de código arbitrario. El método “_load_rng_state()” en “src/transformers/trainer.py” en la línea 3059 llama a “torch.load()” sin el parámetro “weights_only=True”. Este problema afecta a todas las versiones de la biblioteca que soportan “torchmayor o igual que 2.2” cuando se usan con versiones de PyTorch inferiores a 2.6, ya que el gestor de contexto “safe_globals()” no proporciona protección en estas versiones. Un atacante puede explotar esta vulnerabilidad suministrando un archivo de punto de control malicioso, como “rng_state.pth”, que puede ejecutar código arbitrario cuando se carga. El problema está resuelto en la versión v5.0.0rc3.

Information

Published : 2026-04-07 06:16

Updated : 2026-10-26 22:10


NVD link : CVE-2026-1839

Mitre link : CVE-2026-1839

CVE.ORG link : CVE-2026-1839


JSON object : View

Products Affected

huggingface

  • transformers
CWE
CWE-502

Deserialization of Untrusted Data