The vulnerability exists due to the use of pickle.loads on untrusted data originating from environment variables. The core of the vulnerability lies in the datachain.data_storage.serializer.deserialize function, which directly calls pickle.loads on its input. This function is called by datachain.catalog.loader.get_metastore and datachain.catalog.loader.get_warehouse, which read serialized data from the DATACHAIN__METASTORE and DATACHAIN__WAREHOUSE environment variables respectively. An attacker with the ability to set these environment variables can provide a malicious pickle payload, leading to arbitrary code execution when the application initializes the metastore or warehouse. The patch mitigates this by replacing the insecure pickle-based serialization with a safe, json-based approach that uses a registry of allowed classes (CallableRegistry) to prevent the instantiation of arbitrary objects.