Summary
LMDeploy uses Python pickle deserialization for peer messages in its disaggregated-serving engine connection path. When unauthenticated or insufficiently protected endpoints allow an attacker to control the peer endpoint, the engine may execute arbitrary code during message deserialization.
Affected context
The issue occurs in LMDeploy deployments using disaggregated serving, where engine processes receive cache-free peer requests through a ZeroMQ connection. Risk is higher when the HTTP initialization and connection endpoints are exposed without API-key authentication and accept caller-controlled peer endpoint information. Deployments that do not start the disaggregated-serving receive loop may not reach the affected deserialization path.
Exploit preconditions
- Attack surface: HTTP disaggregated-serving initialization and connection endpoints, followed by the engine's peer-to-peer ZeroMQ receive channel
- Required access: Ability to invoke the relevant API endpoints and influence the remote engine endpoint information; authentication may be absent when API keys are not configured
- Trigger point: Receipt of a peer message by the
handle_zmq_recvcoroutine throughrecv_pyobj() - Why exploitation is possible: Pickle deserialization processes the received object before the subsequent type check, allowing attacker-controlled serialized data to execute within the engine process
Why this happens
The vulnerability results from treating peer-supplied bytes as trusted Python objects and deserializing them with pickle.loads() through recv_pyobj(). Python pickle can invoke constructors and other object behaviors during loading, so an isinstance check performed afterward cannot prevent execution. This is CWE-502: Deserialization of Untrusted Data, because validation occurs only after a potentially dangerous deserialization operation.
Potential impact
- An attacker may execute arbitrary code in the LMDeploy engine process
- The serving workload could be compromised or disrupted
- Sensitive model, request, or infrastructure data could be accessed
- The compromised process could be used for lateral movement, depending on its permissions and network reachability
- Model-serving integrity could be affected through tampering or data poisoning
General mitigation guidance
Mitigation generally centers on removing executable deserialization from peer communication and reducing trust in connection metadata.
Common defensive patterns include:
- Replacing pickle-based transport with a data-only serialization format that has an explicit schema
- Validating message structure and types before converting data into application objects
- Authenticating and authorizing all disaggregated-serving initialization and connection requests
- Restricting which peer addresses and ZeroMQ endpoints an engine may contact
- Keeping management APIs on isolated networks and denying untrusted inbound access
- Running engine processes with least privilege and limiting filesystem, network, and host access
- Using cryptographic integrity protection for peer messages where appropriate
- Disabling unused disaggregated-serving features to reduce the exposed attack surface
How teams detect issues like this
Detection approaches may include:
- Static analysis rules identifying
pickle.loads,recv_pyobj(), and equivalent deserialization of network-provided data - Code review checks for type validation that occurs after object deserialization
- API security reviews for unauthenticated peer-initialization and connection endpoints
- Runtime monitoring for unexpected ZeroMQ connections, endpoint changes, or unusual child-process and system activity
- Network policy checks ensuring engines can connect only to approved peer addresses
- CI policy enforcement that blocks unsafe serialization APIs in network-facing code
Automated code review and software composition tools may help identify related unsafe-deserialization patterns.

