CVE-2021-37662

7.1 HIGH

📋 TL;DR

This CVE allows attackers to cause undefined behavior in TensorFlow's boosted trees operations by triggering null pointer dereferences. Attackers can exploit missing input validation in BoostedTreesCalculateBestGainsPerFeature and BoostedTreesCalculateBestFeatureSplitV2 functions. Anyone using affected TensorFlow versions for machine learning tasks is potentially vulnerable.

💻 Affected Systems

Products:
  • TensorFlow
Versions: TensorFlow 2.3.0 to 2.5.0, and potentially earlier 2.x versions
Operating Systems: All operating systems running TensorFlow
Default Config Vulnerable: ⚠️ Yes
Notes: Only affects deployments using boosted trees operations. The vulnerability exists in core TensorFlow code, not dependent on specific configurations.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Remote code execution leading to complete system compromise, data exfiltration, or denial of service.

🟠

Likely Case

Application crashes, denial of service, or memory corruption leading to instability.

🟢

If Mitigated

Minimal impact if proper input validation and sandboxing are implemented.

🌐 Internet-Facing: MEDIUM - Requires specific ML workloads using vulnerable functions, not all TensorFlow deployments.
🏢 Internal Only: MEDIUM - Similar risk profile but limited to internal attack surface.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ✅ No
Complexity: MEDIUM

Exploitation requires crafting specific inputs to the vulnerable functions. No public exploits have been documented.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: TensorFlow 2.6.0, 2.5.1, 2.4.3, 2.3.4

Vendor Advisory: https://github.com/tensorflow/tensorflow/security/advisories/GHSA-f5cx-5wr3-5qrc

Restart Required: Yes

Instructions:

1. Update TensorFlow to patched version: pip install --upgrade tensorflow==2.6.0 (or appropriate version). 2. Restart all services using TensorFlow. 3. Verify the update with: python -c 'import tensorflow as tf; print(tf.__version__)'

🔧 Temporary Workarounds

Disable boosted trees operations

all

Avoid using BoostedTreesCalculateBestGainsPerFeature and BoostedTreesCalculateBestFeatureSplitV2 functions

Input validation wrapper

all

Implement custom input validation for boosted trees function calls

🧯 If You Can't Patch

  • Implement strict input validation and sanitization for all TensorFlow inputs
  • Isolate TensorFlow workloads in containers with minimal privileges

🔍 How to Verify

Check if Vulnerable:

Check TensorFlow version: python -c 'import tensorflow as tf; print(tf.__version__)' - if version is between 2.3.0 and 2.5.0 (excluding patched versions), you are vulnerable.

Check Version:

python -c 'import tensorflow as tf; print(tf.__version__)'

Verify Fix Applied:

Verify TensorFlow version is 2.6.0, 2.5.1, 2.4.3, or 2.3.4: python -c 'import tensorflow as tf; print(tf.__version__)'

📡 Detection & Monitoring

Log Indicators:

  • Segmentation faults in TensorFlow processes
  • Unexpected crashes in ML inference services
  • Memory access violation errors

Network Indicators:

  • Unusual patterns of requests to ML endpoints using boosted trees

SIEM Query:

process_name:"python" AND (event_type:"segmentation_fault" OR error_message:"null pointer") AND process_command_line:"tensorflow"

🔗 References

📤 Share & Export