Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers
Default status is the baseline for the product, each version can override it (e.g. patched versions marked unaffected).
| Vendor | Product | Default status | Versions | ||||||
|---|---|---|---|---|---|---|---|---|---|
| huggingface | huggingface/transformers | affected |
|
Configuration 1 [-]
|
No data.
| Vendor | Product | Versions | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Huggingface | Transformers |
|
| Source | ID | Title |
|---|---|---|
Github GHSA |
GHSA-69w3-r845-3855 | HuggingFace Transformers allows for arbitrary code execution in the `Trainer` class |
No CVSS v4.0
No CVSS v2
This CVE is not in the KEV list.
Exploit prediction score: < 1% (0.388% probability within 30 days)
| Type | Values Removed | Values Added |
|---|---|---|
| CPEs | 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:*:*:*:*:*:* |
|
| Metrics |
cvssV3_1
|
cvssV3_1
|
| Type | Values Removed | Values Added |
|---|---|---|
| First Time appeared |
Huggingface
Huggingface transformers |
|
| Vendors & Products |
Huggingface
Huggingface transformers |
| Type | Values Removed | Values Added |
|---|---|---|
| References |
| |
| Metrics |
threat_severity
|
cvssV3_1
|
| Type | Values Removed | Values Added |
|---|---|---|
| Metrics |
ssvc
|
| Type | Values Removed | Values Added |
|---|---|---|
| Description | 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. | |
| Title | Arbitrary Code Execution via Unsafe torch.load() in Trainer Checkpoint Loading in huggingface/transformers | |
| Weaknesses | CWE-502 | |
| References |
| |
| Metrics |
cvssV3_0
|