CVE-2025-54886: SKOPS Card.get_model happily allows arbitrary code execution
8.4
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
skops | pip | < 0.13.0 | 0.13.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability exists in the skops
library's model loading mechanism. The core of the issue lies in the _load_model
function, which is responsible for loading machine learning models. This function had a critical flaw: if the provided model file was not a .skops
file (which is a secure zip archive), it would fall back to using joblib.load
. The joblib.load
function uses Python's pickle
module, which is not secure against maliciously crafted files and can be exploited for arbitrary code execution. This is a classic example of CWE-502: Deserialization of Untrusted Data.
The vulnerability is exposed to the user through the Card.get_model
method. When a user creates a Card
object with a path to a malicious (non-zip) model file and then calls get_model()
, the chain of calls Card.get_model()
-> Card._model
-> _load_model()
is executed. This triggers the insecure deserialization with joblib.load
, resulting in code execution on the victim's machine.
The patch addresses this by introducing an allow_pickle
flag in the Card
class, which is False
by default. The _load_model
function was modified to check this flag before attempting to use joblib.load
. If allow_pickle
is False
(the default), and the file is not a .skops
file, the function now raises a RuntimeError
instead of insecurely loading it. This change makes the behavior secure by default and requires the user to explicitly opt-in to the potentially dangerous behavior, thus mitigating the risk.
Vulnerable functions
_load_model
skops/card/_model_card.py
Card.get_model
skops/card/_model_card.py