Pickle Load in Serialized Profile Load
CVE Number
CVE-2024-37062
Summary
Profile reports can be serialized and deserialized through the load/loads and dump/dumps functions allowing people to share reports with each other. Reports are serialized using the Python pickle module which is inherently insecure and can lead to arbitrary code being executed once the file is loaded.
Products Impacted
This vulnerability is present in Ydata-profiling v3.7.0 or newer.
CVSS Score: 7.8
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CWE Categorization
CWE-502: Deserialization of Untrusted Data.
Details
In src/ydata_profiling/serialize_report.py pickle is used to load serialized profiles within the loads function. The load function relies on the loads function and is therefore also vulnerable:
def loads(self, data: bytes) -> Union["ProfileReport", "SerializeReport"]:
"""
Deserialize the serialized report
Args:
data: The bytes of a serialize ProfileReport object.
Raises:
ValueError: if ignore_config is set to False and the configs do not match.
Returns:
self
"""
import pickle
try:
(
df_hash,
loaded_config,
loaded_description_set,
loaded_report,
) = pickle.loads(data)
This can be abused by generating a malicious pickle and using the load or loads functions:
In the example above we pickle dumps directly into the loads function, in a real attack the user would be affected by the load function or by passing the bytes into the loads function after reading them from a file or over the network.