CVE-2023-6730

8.8 HIGH

📋 TL;DR

This vulnerability in the Hugging Face Transformers library allows remote code execution through unsafe deserialization of untrusted data. Attackers can exploit this by providing malicious serialized objects, potentially compromising systems running vulnerable versions. Users of the Transformers library in applications that process external data are affected.

💻 Affected Systems

Products:
  • huggingface/transformers
Versions: All versions prior to 4.36
Operating Systems: All operating systems running Python
Default Config Vulnerable: ⚠️ Yes
Notes: Any application using the Transformers library that processes serialized data from untrusted sources is vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete system compromise with arbitrary code execution, data theft, and lateral movement within the network.

🟠

Likely Case

Remote code execution leading to application compromise, data exfiltration, and potential privilege escalation.

🟢

If Mitigated

Limited impact with proper input validation and network segmentation, potentially only denial of service.

🌐 Internet-Facing: HIGH - Applications exposed to the internet that process user-provided data are highly vulnerable to exploitation.
🏢 Internal Only: MEDIUM - Internal applications may still be vulnerable if they process untrusted data from internal sources.

🎯 Exploit Status

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

Exploitation requires the ability to provide malicious serialized data to vulnerable endpoints.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.36.0 and later

Vendor Advisory: https://github.com/huggingface/transformers/commit/1d63b0ec361e7a38f1339385e8a5a855085532ce

Restart Required: Yes

Instructions:

1. Update Transformers package using pip: pip install transformers>=4.36.0
2. Restart all applications using the library
3. Verify no older versions remain in your environment

🔧 Temporary Workarounds

Input Validation and Sanitization

all

Implement strict input validation to reject serialized data from untrusted sources

Network Segmentation

all

Restrict network access to vulnerable applications and implement strict firewall rules

🧯 If You Can't Patch

  • Implement strict input validation to reject all serialized data from untrusted sources
  • Deploy network segmentation and restrict application access to trusted sources only

🔍 How to Verify

Check if Vulnerable:

Check Transformers version: python -c "import transformers; print(transformers.__version__)" - if version < 4.36, system is vulnerable

Check Version:

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

Verify Fix Applied:

After update, verify version is >=4.36: python -c "import transformers; print(transformers.__version__)"

📡 Detection & Monitoring

Log Indicators:

  • Unusual process execution from Transformers applications
  • Unexpected network connections from Transformers processes
  • Errors related to deserialization or pickle loading

Network Indicators:

  • Suspicious outbound connections from Transformers applications
  • Unusual data patterns to/from Transformers endpoints

SIEM Query:

process.name:python AND process.args:*transformers* AND (event.action:process_start OR network.connection)

🔗 References

📤 Share & Export