CVE-2024-3568

9.6 CRITICAL

📋 TL;DR

The huggingface/transformers library contains a critical vulnerability allowing arbitrary code execution through malicious serialized checkpoints. Attackers can execute commands on victim machines by tricking users into loading crafted payloads during training processes. This affects anyone using the vulnerable TFPreTrainedModel.load_repo_checkpoint() function with untrusted data sources.

💻 Affected Systems

Products:
  • huggingface/transformers
Versions: Versions before commit 693667b8ac8138b83f8adb6522ddaf42fa07c125
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability exists when loading checkpoints from untrusted sources via load_repo_checkpoint() function.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Full system compromise with attacker gaining complete control over the machine, data exfiltration, lateral movement, and persistent backdoor installation.

🟠

Likely Case

Execution of arbitrary commands in the context of the running application, potentially leading to data theft, cryptocurrency mining, or ransomware deployment.

🟢

If Mitigated

Limited impact if proper input validation and sandboxing are implemented, though some system access may still be possible.

🌐 Internet-Facing: HIGH
🏢 Internal Only: HIGH

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ✅ No
Complexity: LOW

Exploitation requires victim to load a malicious checkpoint, which could be distributed via model repositories or shared datasets.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Commit 693667b8ac8138b83f8adb6522ddaf42fa07c125 and later

Vendor Advisory: https://github.com/huggingface/transformers/commit/693667b8ac8138b83f8adb6522ddaf42fa07c125

Restart Required: No

Instructions:

1. Update transformers library to latest version. 2. Verify commit 693667b8ac8138b83f8adb6522ddaf42fa07c125 is included. 3. Test checkpoint loading functionality.

🔧 Temporary Workarounds

Disable untrusted checkpoint loading

all

Avoid loading checkpoints from untrusted sources or repositories.

# No specific command - implement policy to only load from trusted sources

Implement input validation

all

Add validation to ensure checkpoints come from trusted sources before loading.

# Implement source verification in code before calling load_repo_checkpoint()

🧯 If You Can't Patch

  • Implement strict access controls to prevent loading checkpoints from untrusted sources
  • Run transformers in isolated containers or sandboxes with minimal privileges

🔍 How to Verify

Check if Vulnerable:

Check if your transformers version includes commit 693667b8ac8138b83f8adb6522ddaf42fa07c125. If not, you are vulnerable.

Check Version:

python -c "import transformers; print(transformers.__version__)"

Verify Fix Applied:

Verify the commit hash in your installed transformers library and test loading checkpoints from safe sources.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected process spawns from transformers processes
  • Network connections from transformers to unexpected destinations
  • File system modifications by transformers process

Network Indicators:

  • Outbound connections to suspicious IPs from transformers processes
  • DNS requests for known malicious domains

SIEM Query:

process_name:"python" AND (process_command_line:"transformers" OR process_command_line:"load_repo_checkpoint") AND (process_spawned:true OR network_connection:true)

🔗 References

📤 Share & Export