Summary
SGLang's multimodal generation runtime scheduler exposes a ROUTER socket bound to 0.0.0.0 that deserializes incoming messages using pickle.loads() without enforcing trust boundaries.
When this socket is reachable from untrusted networks, a remote attacker can craft malicious pickle payloads that lead to arbitrary code execution on the host running the scheduler.
Affected context
This vulnerability occurs in deployments of the SGLang multimodal generation runtime where the scheduler's ROUTER socket is left at its default network binding (0.0.0.0) and accepts serialized messages from external clients.
The risk increases significantly when the runtime is exposed directly to the internet or to untrusted internal networks (e.g., shared clusters, multi-tenant environments) without additional isolation, authentication, or network-level access controls.
Exploit preconditions
- Attack surface: Network-accessible ROUTER socket exposed by the SGLang multimodal runtime scheduler
- Required access: Ability to open a TCP connection to the scheduler's listening port (no prior authentication required, if not otherwise enforced)
- Trigger point: Sending a crafted message containing a malicious Python pickle object that is passed to
pickle.loads() - Why exploitation is possible: Python's
pickleprotocol is designed for object serialization between trusted endpoints and allows arbitrary code execution during deserialization; using it on untrusted network data without validation or sandboxing directly maps to unsafe deserialization
Why this happens
The core issue is the use of Python's pickle.loads() on data received directly from a network socket that listens on all interfaces by default.
pickle is a powerful but insecure serialization format that can instantiate arbitrary Python objects and execute attacker-controlled code as part of the deserialization process.
By combining an unauthenticated, globally bound ROUTER socket (0.0.0.0) with blind trust in incoming serialized payloads, the runtime effectively treats external network traffic as executable data, which corresponds to CWE-502: Deserialization of Untrusted Data.
Potential impact
- Remote execution of arbitrary code with the privileges of the SGLang scheduler process
- Takeover of the host machine running the multimodal generation runtime
- Lateral movement within the surrounding infrastructure or Kubernetes cluster
- Exfiltration or tampering of in-memory model data, prompts, and generation outputs
- Use of the compromised host as a pivot point for further attacks within the environment
General mitigation guidance
Effective mitigation focuses on eliminating unsafe deserialization and narrowing the network trust boundary:
- Replace
picklewith a safer, non-executable serialization format (e.g., JSON, MessagePack, Protobuf) for all untrusted network inputs. - Restrict the scheduler's network binding to local or explicitly trusted interfaces instead of
0.0.0.0, and place it behind authenticated, access-controlled frontends or gateways. - Introduce strong authentication and authorization at the protocol or transport layer (e.g., mTLS, API tokens) so that only trusted clients can reach the scheduler.
- Run the scheduler under least-privilege OS accounts and, where possible, inside hardened containers or sandboxes to minimize the blast radius of potential compromise.
- Apply network segmentation and firewall rules to ensure the ROUTER socket is not directly reachable from the public internet or untrusted segments.
How teams detect issues like this
Detection typically involves both code-centric and infrastructure-centric approaches:
- Static analysis: Flag use of
pickle.loads()(and related APIs) on data originating from sockets, message queues, or other external inputs; enforce rules that disallowpicklein network protocols. - Code review: Look for networking code that binds to
0.0.0.0and performs object deserialization; verify that only schema-validated, non-executable formats are used for cross-boundary communication. - Runtime monitoring: Monitor process behavior for suspicious child processes, abnormal file system access, or unexpected network connections initiated by the scheduler process.
- Configuration and policy enforcement: Use infrastructure-as-code scanning and security policies to detect externally exposed ports for the SGLang runtime and require authentication and restricted bindings.

