Summary
SGLang's multimodal generation module exposes a remote code execution risk by deserializing attacker-controlled data over a ZMQ broker using Python's pickle.loads() without any authentication.
An unauthenticated attacker who can reach the ZMQ endpoint may execute arbitrary code in the SGLang process context, potentially compromising the host and any connected workloads.
Affected context
This vulnerability occurs in deployments of SGLang that expose the multimodal generation module via a ZeroMQ (ZMQ) broker and rely on pickle-based message deserialization.
It is most relevant when:
- The ZMQ broker is reachable over a network (e.g., intra-cluster or public-facing),
- No authentication, encryption, or network-level isolation is enforced for that broker,
- The same process has access to sensitive models, data, or system resources.
Exploit preconditions
- Attack surface: Network-accessible ZMQ broker used by the SGLang multimodal generation module.
- Required access: Ability to open a connection to the broker endpoint (no credentials required).
- Trigger point: Sending crafted serialized payloads that will be processed by pickle.loads() on the server side.
- Why exploitation is possible: Python's pickle format allows embedding object types and behaviors which are executed during deserialization, and the server treats incoming data as trusted without authentication or origin validation.
Why this happens
The core issue is the use of Python's pickle.loads() on untrusted, remote input, which directly maps to CWE-502: Unsafe Deserialization.
Pickle is a general-purpose serialization format that can instantiate arbitrary Python objects and execute their special methods during loading. When used on data received over a network without authentication or integrity checks, an attacker can craft payloads that cause execution of arbitrary code on deserialization.
In the SGLang multimodal generation module, the ZMQ broker acts as a message transport but does not enforce a trust boundary, allowing arbitrary clients to send data that is implicitly trusted and deserialized as if it originated from a benign, internal component.
Potential impact
- Execution of arbitrary code with the privileges of the SGLang process.
- Full compromise of the host running the SGLang instance, depending on OS-level isolation.
- Theft or tampering of models, prompts, and generated data.
- Lateral movement to adjacent services or systems reachable from the compromised host.
- Use of the compromised instance for further attacks (e.g., data exfiltration, cryptomining, or supply-chain manipulation).
General mitigation guidance
Since the vulnerability stems from unsafe deserialization of untrusted network data, mitigations generally focus on removing implicit trust and reducing deserialization capabilities:
- Replace pickle with a safer, data-only serialization format (e.g., JSON, MessagePack, or protocol buffers) that cannot encode arbitrary code execution behavior.
- Introduce strong authentication and authorization around message brokers so only trusted components can connect and send data.
- Constrain accepted message types through explicit schemas and validation, rejecting data that does not conform.
- Run the multimodal generation service under least-privilege accounts and within sandboxed or containerized environments to limit damage from a compromise.
- Apply network segmentation and firewall rules so the ZMQ broker is never exposed beyond the minimum required scope (ideally restricted to a private service network).
How teams detect issues like this
Detection efforts can focus on both code-level patterns and runtime behavior:
- Use static analysis or code scanning rules to flag uses of pickle.loads(), pickle.load(), or equivalent unsafe deserialization APIs on data that can cross process or network boundaries.
- During code review, treat any serialization/deserialization on socket, broker, or RPC paths as high-risk and verify that only data-only formats are used.
- Implement runtime monitoring for unusual child processes, filesystem changes, or outbound connections originating from the SGLang service, which can indicate successful exploitation.
- Incorporate security policy checks in CI/CD pipelines that fail builds when high-risk deserialization patterns are present without appropriate justification and controls.

