CVE-2024-7776

9.1 CRITICAL

📋 TL;DR

A path traversal vulnerability in the ONNX framework's download_model function allows attackers to overwrite arbitrary files by exploiting malicious tar archives. This affects users of ONNX versions up to 1.16.1 who download models from untrusted sources, potentially leading to remote code execution.

💻 Affected Systems

Products:
  • ONNX (Open Neural Network Exchange)
Versions: All versions up to and including 1.16.1
Operating Systems: All platforms running ONNX
Default Config Vulnerable: ⚠️ Yes
Notes: Vulnerability is triggered when downloading models via the download_model function from untrusted sources.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote command execution with the privileges of the ONNX process, potentially leading to full system compromise.

🟠

Likely Case

Arbitrary file overwrite in the user's directory, enabling data corruption, privilege escalation, or persistence mechanisms.

🟢

If Mitigated

Limited to file corruption in isolated environments with strict file permissions and no sensitive data in accessible directories.

🌐 Internet-Facing: HIGH - Exploitable via downloading models from untrusted sources, which is common in ML workflows.
🏢 Internal Only: MEDIUM - Requires user interaction to download malicious content, but internal threat actors could exploit it.

🎯 Exploit Status

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

Exploitation requires the user to download a malicious tar file, but the vulnerability itself is straightforward to trigger.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 1.16.2 and later

Vendor Advisory: https://github.com/onnx/onnx/security/advisories

Restart Required: No

Instructions:

1. Update ONNX using pip: 'pip install --upgrade onnx>=1.16.2'. 2. Verify the update with 'pip show onnx'. 3. No restart required as it's a library update.

🔧 Temporary Workarounds

Validate tar file contents

all

Manually inspect and validate tar file contents before extraction in the download_model function.

# Custom validation script required - no single command

Use trusted model sources only

all

Restrict model downloads to verified, trusted repositories and sources.

🧯 If You Can't Patch

  • Implement strict file permissions to limit write access to critical directories.
  • Monitor and audit file system changes in directories where ONNX downloads models.

🔍 How to Verify

Check if Vulnerable:

Check ONNX version with 'pip show onnx' or 'python -c "import onnx; print(onnx.__version__)"'. If version is <=1.16.1, the system is vulnerable.

Check Version:

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

Verify Fix Applied:

After updating, verify version is >=1.16.2 using the same commands.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected file writes outside expected model directories
  • Tar extraction errors or warnings in application logs

Network Indicators:

  • Downloads of tar files from untrusted sources to ONNX applications

SIEM Query:

source="application_logs" AND ("tar extraction" OR "download_model") AND ("path traversal" OR "../")

🔗 References

📤 Share & Export