Summary
Feast contains an unsafe deserialization flaw where user-defined function bodies received over gRPC are decoded and passed to dill.loads() without prior authorization.
An attacker who can send crafted requests to the registry server may embed malicious serialized Python objects that execute OS commands as the Feast service account, resulting in remote code execution.
Affected context
This vulnerability appears in Feast deployments where the registry server:
- Exposes a gRPC interface that accepts OnDemandFeatureView specifications
- Decodes
user_defined_function.bodyfrom base64 and deserializes it usingdill.loads() - Performs authorization checks only after deserialization rather than before
It is most relevant in environments where external clients or services can reach the registry gRPC endpoint, even if they are not fully authenticated or authorized.
Exploit preconditions
- Attack surface: gRPC registry server endpoint receiving OnDemandFeatureView specs
- Required access: Network reachability to the Feast registry service; no valid credentials needed if endpoint is exposed without strict authentication
- Trigger point: Submission of a spec with a crafted
user_defined_function.bodyfield containing a malicious serialized Python object - Why exploitation is possible: The registry server deserializes attacker-controlled data with
dill.loads()before enforcing authorization or validating the payload, allowing arbitrary object construction and execution of attacker-controlled__reduce__logic
Why this happens
The core issue is the use of a powerful, general-purpose Python deserialization mechanism (dill.loads()) on data received over a remote interface without treating it as untrusted input.
This directly maps to CWE-502 (Unsafe Deserialization), where serialized data is assumed to be benign and is turned back into live objects that can carry executable behavior.
In this pattern, a feature specification field (user_defined_function.body) becomes an implicit code-loading channel; because authorization and content validation occur only after deserialization, attackers can inject objects whose special methods (such as __reduce__) run OS commands when loaded.
Potential impact
- Remote code execution as the Feast service account on the registry server host or container
- Compromise of the feature registry and associated configuration state
- Tampering with feature definitions, leading to data integrity issues and model behavior manipulation
- Pivoting to other services or infrastructure reachable from the compromised Feast environment
- Disclosure of sensitive configuration, credentials, or environment-specific secrets accessible to the service account
General mitigation guidance
Effective mitigation focuses on removing unsafe deserialization from remote-facing paths and minimizing trust in client-supplied function bodies.
Common defensive patterns include:
- Avoiding general-purpose deserialization of user-supplied code or objects; prefer constrained representations such as declarative configurations or vetted, pre-registered functions
- Performing authentication and authorization before any parsing or interpretation of client data, especially when handling executable or dynamic content
- Restricting allowable fields and types for user-defined functions, and enforcing schema- and content-level validation that disallows embedded serialization formats
- Running registry and compute services with least-privilege service accounts and minimizing OS-level capabilities to reduce blast radius if code execution occurs
- Treating any mechanism that loads code or objects from external sources as a high-risk interface and defaulting to secure-by-design alternatives (e.g., built-in function catalogs, static registration processes)
How teams detect issues like this
Organizations can detect and manage similar issues by:
- Applying static analysis rules that flag uses of
pickle,dill, and other general-purpose serialization libraries on remote or untrusted inputs - Incorporating secure coding guidelines into code review, with explicit checks around interfaces that accept function bodies or scripts from clients
- Logging and monitoring deserialization paths and gRPC endpoints for anomalous payloads or unexpected object structures
- Using automated security testing tools (e.g., SAST, DAST, or specialized linters) to identify unsafe deserialization and missing authorization checks in request-handling code
- Enforcing architectural policies that prohibit execution or deserialization of arbitrary client-provided code inside long-lived services

