/

CVE-2026-26210

Severity:

CRITICAL RISK

(9.8)

Unsafe Deserialization in KTransformers balance_serve RPC

CVE-2026-26210

Analyzed

Vulnerability type

Category:

Unsafe Deserialization

CWE:

CWE-502

Impact:

Remote Code Execution over Network

Severity:

CRITICAL RISK

(9.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

KTransformers through version 0.5.3 exposes an unauthenticated ZMQ ROUTER socket that deserializes incoming messages using Python's pickle.loads() without validation.

An attacker who can reach this socket over the network can send a crafted pickle payload that results in arbitrary code execution with the privileges of the ktransformers process.

Affected context

This vulnerability affects deployments of KTransformers (through 0.5.3) that:

  • Run in balance_serve backend mode with the scheduler RPC server enabled
  • Bind a ZeroMQ (ZMQ) ROUTER socket to a network-accessible interface (e.g., 0.0.0.0)
  • Do not place the scheduler endpoint behind network isolation, authentication, or a trusted control plane

In such setups, the scheduler treats arbitrary incoming ZMQ messages as trusted control traffic and unpickles them directly in the server process.

Exploit preconditions

  • Attack surface: Network-exposed ZMQ ROUTER socket used by the KTransformers scheduler RPC server.
  • Required access: Ability to establish a network connection to the scheduler's ZMQ endpoint (no authentication required by default).
  • Trigger point: Sending a specially crafted message containing a malicious Python pickle object that is passed to pickle.loads() by the scheduler.
  • Why exploitation is possible: The scheduler:
  • Binds to all interfaces without access control
  • Uses pickle.loads() on untrusted network data
  • Performs no schema validation, type checking, or sandboxing before or after deserialization

This combination lets attacker-controlled pickle opcodes be executed as Python code within the ktransformers process.

Why this happens

The core issue is the use of Python's pickle module to deserialize untrusted data received over a network socket. pickle is a general-purpose serialization format that supports arbitrary object graphs, including objects that can execute code during deserialization.

In KTransformers balance_serve mode, the scheduler RPC server:

  • Treats every inbound ZMQ message as trusted control data
  • Calls pickle.loads() directly on the message body
  • Exposes this behavior on a socket bound to all interfaces with no authentication

This matches CWE-502: Deserialization of Untrusted Data, where attacker-controlled serialized data can instantiate or invoke objects that run arbitrary code inside the application process.

Potential impact

  • Remote execution of arbitrary Python code within the ktransformers scheduler process
  • Full compromise of the host account under which KTransformers runs
  • Lateral movement within the environment by pivoting from the compromised host
  • Access to in-memory model weights, configuration, and any connected data sources
  • Manipulation of model serving behavior, including data poisoning or model misuse
  • Use of the compromised host as a foothold for broader infrastructure attacks

General mitigation guidance

Effective mitigation focuses on eliminating unsafe deserialization and shrinking the trust boundary around control channels:

  • Avoid pickle for untrusted data:
  • Replace pickle with safer, data-only formats such as JSON, MessagePack, or protocol buffers for RPC and control messages.
  • If complex types are required, design explicit schemas and serialization logic that do not execute arbitrary constructors.
  • Constrain the network exposure of control sockets:
  • Bind scheduler RPC sockets only to localhost or private interfaces where possible.
  • Place the scheduler behind authenticated and encrypted channels (e.g., mTLS, VPN, or service mesh) rather than exposing it directly.
  • Introduce strict validation and type checking:
  • Validate message structure, types, and allowed commands before processing.
  • Treat all external control messages as untrusted and enforce explicit whitelists for accepted operations.
  • Harden runtime privileges:
  • Run KTransformers with least-privilege OS accounts and restricted filesystem access.
  • Use containerization or sandboxing to limit the blast radius if code execution occurs.
  • Apply secure-by-default configuration:
  • Document and ship configurations that default to non-public bindings.
  • Require explicit opt-in for any remote control endpoints and pair them with authentication.

How teams detect issues like this

Detection can combine code-level analysis, configuration audits, and runtime monitoring:

  • Static analysis and code review:
  • Search for pickle.loads, pickle.load, or similar unsafe deserialization APIs in network-facing or RPC paths.
  • Flag patterns where pickle is used on data read from sockets, message queues, or external files without prior validation.
  • Review scheduler and RPC server components for bindings to 0.0.0.0 or other public interfaces without access control.
  • Configuration and deployment checks:
  • Scan deployment manifests, container specifications, and service configurations to identify ZMQ endpoints bound to all interfaces.
  • Enforce policies that prohibit unauthenticated remote administration or control planes.
  • Runtime and network monitoring:
  • Monitor for unexpected inbound ZMQ traffic to scheduler ports from untrusted networks.
  • Use intrusion detection systems to flag anomalous process behavior (e.g., shell invocation, network scans) originating from ktransformers processes.
  • Automated tooling:
  • Integrate SAST tools that include rules for unsafe deserialization (CWE-502) and unsafe use of pickle.
  • Use configuration-as-code scanners to enforce that control-plane sockets are internal-only and authenticated.

Sources

SourceLink
chocapikk.comchocapikk.com/posts/2026/ktransformers-pickle-rce/
github.comgithub.com/kvcache-ai/ktransformers/pull/1944
vulncheck.comvulncheck.com/advisories/ktransformers-unsafe-deserialization-rce-via-balance-serve

Frequently asked

questions

It can be, if the scheduler's ZMQ ROUTER socket is bound to a publicly routable interface and exposed through firewall or load balancer rules. Any host that can reach the exposed socket can potentially exploit the issue. If the socket is restricted to localhost or an isolated network segment, exposure is limited to those networks.

No application-level credentials are required under the described configuration. The vulnerable ZMQ socket performs no authentication, so network-level reachability is the primary requirement for an attacker.

The most robust fix is to stop using pickle (and similar code-executing serializers) for any data that could originate outside a tightly controlled trust boundary. Replace it with a data-only serialization format, define explicit schemas for RPC messages, and ensure any control socket is authenticated and restricted to trusted peers.

Establish engineering guidelines that prohibit pickle (and equivalent unsafe deserialization mechanisms) for network-facing functionality, enforce safe-by-default network bindings and authentication for control channels, and include automated checks in CI to detect unsafe deserialization and insecure bindings. Regular security reviews of messaging and orchestration components help catch design-level trust boundary issues before release.

Find out what's already
exploitable in your codebase.