/

CVE-2026-31048

Severity:

CRITICAL RISK

(9.8)

Code Injection via Insecure Deserialization in Pyro v3.x

CVE-2026-31048

Deferred

Vulnerability type

Category:

Code Injection via Insecure Deserialization

CWE:

CWE-94

Impact:

Remote Code Execution

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

The pickle-based messaging protocol in Pyro v3.x can be abused to execute arbitrary code when it deserializes attacker-controlled pickled strings.

If an attacker can send crafted messages into a Pyro service using this protocol, they can cause the server process to run arbitrary Python code with its privileges.

Affected context

This vulnerability appears in applications that embed or rely on Pyro v3.x and accept messages over the network using its pickle-based protocol.

It is relevant where:

  • Pyro services are exposed over untrusted or partially trusted networks, and
  • Incoming messages are deserialized using Python's pickle without strong authentication, isolation, or input trust guarantees.

Environments that assume all Pyro clients are trusted are particularly at risk if that assumption is violated (e.g., lateral movement inside a network).

Exploit preconditions

  • Attack surface: Network-exposed Pyro services using the v3.x pickle protocol.
  • Required access: Ability to initiate or intercept Pyro protocol traffic and send crafted pickled messages to the target service.
  • Trigger point: The server deserializes the attacker-supplied pickled payload as part of normal message handling.
  • Why exploitation is possible: Python's pickle format is inherently capable of encoding arbitrary object construction and code execution; treating untrusted pickled data as safe input allows attackers to embed execution gadgets that run when unpickled.

Why this happens

The core issue is reliance on Python's pickle module for deserializing data originating from untrusted or semi-trusted sources.

Pickle is not a data-only format; it can encode instructions that cause arbitrary object instantiation and method invocation during loading.

By accepting and loading pickled messages from the network without strict trust boundaries, the application creates a classic code injection via deserialization scenario.

This aligns with CWE-94 because user-controlled serialized data can influence what code runs on the server, effectively allowing the attacker to inject and execute arbitrary Python operations during unpickling.

Potential impact

  • Remote execution of arbitrary Python code within the Pyro server process
  • Complete compromise of the affected application instance
  • Theft or manipulation of sensitive in-memory data handled by the service
  • Installation of backdoors, additional malware, or pivot tooling on the host
  • Use of the compromised service as a foothold for lateral movement across the network

General mitigation guidance

Effective mitigation focuses on eliminating or strictly constraining unsafe deserialization and reducing the privileges of components that must handle it:

  • Prefer data-only serialization formats (e.g., JSON, MessagePack, protocol buffers) for remote communication instead of pickle.
  • Where legacy behavior must be supported, isolate pickle-based processing behind a strongly authenticated, trusted channel and avoid exposing it to arbitrary clients.
  • Enforce strict authentication and authorization for all Pyro endpoints, reducing the set of entities allowed to send messages.
  • Run Pyro services with least privilege (reduced OS permissions, separate service accounts, and minimal filesystem access) to limit blast radius if compromise occurs.
  • Use network segmentation and firewall rules so that only intended clients can reach Pyro services, and avoid exposing them directly to the public internet.

How teams detect issues like this

Detection generally combines code-level inspection with runtime monitoring:

  • Static analysis & code review:
  • Flag use of pickle.load, pickle.loads, or related APIs on data received from network sockets, IPC channels, or other untrusted sources.
  • Look for Pyro v3.x usage that assumes implicit trust of any client without strong authentication or transport controls.
  • Enforce code review guidelines that prohibit pickle for untrusted data and require documented justification for any remaining uses.
  • Runtime and operational monitoring:
  • Monitor Pyro services for anomalous behavior such as unexpected subprocess creation, shell invocation, or unusual file access.
  • Use application-level logging to capture connection sources and message patterns and alert on unexpected clients or spikes in message volume.
  • Policy enforcement:
  • Integrate automated checks into CI/CD pipelines that scan for unsafe deserialization patterns.
  • Establish security policies that mandate safer serialization formats for new services and restrict pickle to tightly controlled contexts.

Sources

SourceLink
github.comgithub.com/Sif-0x01/security-advisories/security/advisories/GHSA-7625-w9h5-83rv
github.comgithub.com/irmen/Pyro3/blob/master/Pyro/protocol.py#L672-L711
github.comgithub.com/irmen/Pyro3/blob/master/docs/9-security.html#L341-L346

Frequently asked

questions

Yes. If a Pyro v3.x service is reachable over the network and accepts pickled messages from clients, an attacker who can connect to it can remotely deliver a malicious payload that executes code during deserialization.

The attacker generally needs the ability to send messages using the Pyro protocol to the vulnerable service.

In many deployments this means basic network reachability; in others, it may also require bypassing authentication or gaining access to an internal network segment.

The most robust fix is to remove pickle from network-exposed communication paths and adopt a data-only serialization format.

Where that is not immediately possible, isolate and constrain pickle usage, require strong authentication between endpoints, and ensure the deserializing process runs with minimal privileges.

Establish architectural and coding standards that forbid general-purpose executable serialization formats (like pickle) for untrusted data, require explicit threat modeling for any serialization mechanism, and enforce these rules through automated tooling and code review.

Regular security reviews of network protocols and message handling code can also catch unsafe deserialization before deployment.

Find out what's already
exploitable in your codebase.