Summary
Ludwig framework versions through 0.10.4 are vulnerable to insecure deserialization when handling dataset paths passed to the predict() method.
If a user-supplied dataset is a pickle (.pkl) file, it is loaded via pandas.read_pickle() without validation, allowing a malicious file to trigger arbitrary code execution on the prediction host.
Affected context
The vulnerability occurs in Ludwig's prediction workflow when applications call predict() with a file path to input data.
Ludwig automatically infers file format and, for .pkl inputs, uses pandas.read_pickle() to load the content.
In deployments where prediction endpoints accept user-controlled or untrusted dataset files (e.g., uploaded datasets, API-exposed file paths, or indirectly referenced storage objects), an attacker-controlled pickle file can be processed without additional validation or sandboxing.
Exploit preconditions
- Attack surface: Any Ludwig-powered prediction interface that accepts user-specified dataset paths or files.
- Required access: Ability to supply or influence the pickle file that
predict()will read (e.g., file upload, path reference, or shared storage write access). - Trigger point: Invocation of Ludwig's
predict()method on a.pkldataset, which internally callspandas.read_pickle(). - Why exploitation is possible: Pickle deserialization is inherently capable of instantiating arbitrary Python objects with side effects, and Ludwig treats
.pklinputs as trusted data without enforcing type constraints, content validation, or deserialization safeguards.
Why this happens
The core issue is Ludwig's reliance on Python pickle-based deserialization for user-provided datasets in the prediction path.
When the framework auto-detects a .pkl file, it delegates loading to pandas.read_pickle(), which uses Python's pickle module and will execute arbitrary object constructors embedded in the file.
This aligns with CWE-502: Deserialization of Untrusted Data, where untrusted input is fed into a general-purpose deserialization mechanism that was designed for trusted, in-process data.
Conceptually, the insecure pattern is treating serialized objects as mere "data files," rather than as executable object graphs, and not constraining or authenticating the source or structure of those objects.
Potential impact
- Execution of arbitrary OS commands with the privileges of the Ludwig prediction process.
- Full compromise of the host running the prediction service (including lateral movement, data theft, or service disruption).
- Exposure or manipulation of sensitive ML assets such as models, training data, and configuration secrets accessible to the process.
- Installation of backdoors or malware on the application server.
- Abuse of the compromised environment for further attacks within the network or cloud account.
General mitigation guidance
Mitigations generally focus on eliminating unsafe object deserialization and tightening trust boundaries around input data:
- Avoid using pickle-based formats for user-supplied or otherwise untrusted datasets; prefer safer, purely data-oriented formats such as CSV, JSON, or Parquet.
- Introduce explicit format whitelists for prediction inputs and reject
.pklor other object-serialization formats by default. - Apply strict input validation and content checks before any deserialization logic, including verifying expected schemas and types.
- Separate runtime roles and apply least privilege so that the prediction process runs with minimal OS and network privileges, reducing blast radius if compromise occurs.
- Consider isolating prediction workloads in containers, sandboxes, or dedicated execution environments that do not have access to sensitive infrastructure resources.
- Treat any mechanism that reconstructs Python objects from external input as untrusted and avoid it entirely on remote or multi-tenant interfaces.
How teams detect issues like this
High-level detection commonly combines code-level and operational measures:
- Static analysis: Flag calls to
pandas.read_pickle(),pickle.load(), or equivalent APIs that are reachable from request handlers or other untrusted input paths. - Code review: Look for prediction or data-loading code paths that perform automatic format detection and include pickle handling for user-supplied files; ensure reviewers challenge any use of object deserialization on external input.
- Security testing: Incorporate tests that attempt to pass known unsafe serialized objects into prediction endpoints, confirming they are rejected and never deserialized.
- Policy enforcement: Establish engineering standards disallowing pickle or similar formats (e.g.,
joblib,dill) for untrusted input, and enforce these via CI checks or pre-merge hooks. - Runtime monitoring: Log and monitor uses of pickle-loading functions, especially from network-accessible services, and alert on unexpected
.pklprocessing events.

