You need to agree to share your Hugging Face information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

sklearn DecisionTree Heap Information Leak via node_count Mismatch

Security research artifact. Do not use in production.

Summary

scikit-learn 1.8.0's Tree.__setstate__ (Cython, _tree.pyx line 824) sets self.node_count directly from the deserialized pickle state without validating that node_count <= capacity (the actual size of the nodes array). When node_count exceeds the actual array size, tree properties (.feature, .threshold, .value) return NumPy slices that read past the allocated C buffer into adjacent heap memory.

The OOB heap data is captured into the serialized model file via __getstate__ + memcpy, making it persistent and transferable.

Impact

  • CWE-125: Out-of-bounds Read
  • Heap data disclosure: Positions beyond the legitimate node count contain raw heap data (pointers, strings, other allocations)
  • Training data exfiltration: When the malicious model is created after fit(), the OOB heap read captures ACTUAL TRAINING DATA (numpy float64 values from X_train). Verified: 70% of unique training feature values recovered in a 5000-position scan. Training data appears in contiguous, repeating sequences matching the original array layout.
  • Persistent: The leaked data is frozen into the .joblib/.pkl file and readable by anyone who loads it
  • Affects ALL tree-based estimators: DecisionTree, RandomForest, GradientBoosting, ExtraTrees, AdaBoost, BaggingClassifier

Files

  • poc_heap_leak.joblib -- Pre-built malicious model (regenerated by PoC script)
  • poc_sklearn_heap_leak.py -- Full PoC: creates malicious .joblib, demonstrates heap data leak

Reproduction

pip install scikit-learn==1.8.0 joblib numpy
python3 poc_sklearn_heap_leak.py

Output shows leaked heap data as ASCII strings, hex dumps, and non-zero value counts proving the read extends past the allocated buffer into adjacent process memory.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support