SAI Security Advisory

Pickle Load on inhouse BYOM model finetune leads to arbitrary code execution

September 12, 2024

Products Impacted

This vulnerability is present in MindsDB versions v23.10.2.0 or newer.

CVSS Score: 7.1

AV:N/AC:H/PR:L/UI:R/S:U/C:H/I:H/A:H

CWE Categorization

CWE-502: Deserialization of Untrusted Data

Details

To exploit this vulnerability, an attacker authenticated to a MindsDB instance can create a Python script to train a model on a dataset and make predictions. Within the script, an attacker can include a class to create a malicious pickle object within the method used to train the model. The attacker can then use the ‘Upload Custom Model’ feature within the MindsDB UI to upload this Python script, along with the related requirements.txt file, which would need to contain any libraries required to successfully achieve the exploit. They can then upload the relevant dataset as a file and use the appropriate SQL query to train the model with it and the uploaded script.

When the model is trained, it is serialized along with the malicious pickle object due to the use of pickle.dumps within the train method of the ModelWrapperUnsafe class in the mindsdb/integrations/handlers/byom_handler/byom_handler.py file. The aforementioned class is used when the BYOM engine is changed to ‘inhouse’. A finetune query can subsequently run on the model. Upon the query being run, the code is passed to the vulnerable finetune method of the ModelWrapperUnsafe class in the mindsdb/integrations/handlers/byom_handler/byom_handler.py file, which calls pickle.loads on the model, as shown below:

def finetune(self, df, model_state, args):
    	self.model_instance.__dict__ = pickle.loads(model_state)

    	call_args = [df]
    	if args:
        	call_args.append(args)

    	self.model_instance.finetune(df, args)

    	return pickle.dumps(self.model_instance.__dict__, protocol=5)
       

This leads to the malicious pickle object being deserialized and any arbitrary code contained within it being executed on the server.

Related SAI Security Advisory

CVE-2026-79721

September 8, 2026

MLflow Vulnerability Report

MLflow

A malicious MLflow model artifact can cause code execution during mlflow.pyfunc.load_model. The loader reads import settings from the model’s MLmodel file and imports the specified module without an allowlist or trust check, allowing attacker-controlled code in the artifact to run on the loading machine.

September 2026
CVE-2026-79718, CVE-2026-79719, CVE-2026-79720

August 27, 2026

Netron Vulnerability Report

Netron

Reflected XSS in Netron versions <=9.1.2 on desktop application through unsanitized node names allows an attacker to hide certain nodes, perform port scanning or abuse a Chrome n-day to achieve Remote Code Execution.

August 2026