Cloudanix VulnDB

CVE-2024-48063

None

CVSS

—

EPSS

1.6%

Published

Oct 29, 2024

CISA due date

—

Cloudanix analysis

Next patch cycle SSVC: Track

A feature in a popular machine learning framework could allow an attacker to take over a server if that feature is improperly exposed to untrusted sources.

Exploitation
Remote Authenticated
Attacker needs
Low Privilege
Complexity
Low
Impact
Full Compromise
Component
Library
Class
Deserialization
Remediation
Upgrade
Effort
Medium
Patch risk
Medium

What it actually does

The vulnerability allows for remote code execution (RCE) through the deserialization of untrusted data in PyTorch's RemoteModule. An attacker who can send a specially crafted serialized object to an exposed RemoteModule can execute arbitrary code with the privileges of the PyTorch application process. This is a classic insecure deserialization flaw.

Why it matters to the business

A successful exploit could lead to a complete compromise of the machine learning server. This can result in the theft of valuable intellectual property such as trained models and proprietary datasets, disruption of AI-powered services, and significant reputational damage. The compromised system could also be used as a pivot point to attack other systems within the corporate network. The risk is highest for systems where distributed computing features are incorrectly exposed to untrusted networks.

How an attack unfolds

An attacker first identifies a PyTorch application that exposes its RemoteModule or distributed RPC framework to an untrusted network. The attacker then crafts a malicious payload, typically using Python's pickle format, which contains code to be executed upon deserialization. This payload is sent to the vulnerable PyTorch service. The service, expecting a legitimate serialized object, deserializes the attacker's payload, which triggers the execution of the embedded malicious code. This could result in a reverse shell connecting back to the attacker, data exfiltration, or the deployment of further malware.

How to fix it

The primary remediation is to follow secure architecture principles. Never expose PyTorch's distributed computing components, including RemoteModule, to untrusted networks or clients. Treat all data from untrusted sources as potentially malicious and avoid deserializing it. Implement strict network segmentation and firewall rules to ensure that only authorized, trusted systems can communicate with the ports used by the PyTorch RPC framework. While the issue is noted in PyTorch version 2.4.1 and earlier, the fundamental solution is not a patch but a secure design that prevents untrusted data from reaching the deserialization functions.

How to confirm the fix worked

To validate that your systems are not exposed, perform a thorough architectural review of all applications using PyTorch's distributed features. Confirm that these services are not bound to public-facing network interfaces. Use network scanning tools to verify that the ports associated with PyTorch RPC are not accessible from untrusted networks (e.g., the internet). Conduct code reviews to ensure that the application does not deserialize any data that originates from an untrusted source.

Typical attack path

  1. Attacker performs network scanning to find exposed PyTorch RPC ports.
  2. Attacker identifies an application using the vulnerable RemoteModule component.
  3. Attacker crafts a malicious serialized object (e.g., a pickle payload) designed to execute a command.
  4. Attacker sends the malicious object to the exposed service.
  5. The PyTorch application deserializes the object, triggering remote code execution.
  6. Attacker gains a foothold on the server and proceeds with post-exploitation activities like data theft or lateral movement.

How to detect it

To detect potential exploitation, monitor network logs for unexpected connections to the ports used by PyTorch's RPC framework. On host systems, monitor process execution logs for suspicious child processes being spawned by the PyTorch application process. For example, the main application process suddenly launching shells (sh, bash, powershell), network utilities (curl, wget), or other interpreters is a strong indicator of compromise. Since the exploit payload is embedded within legitimate-looking traffic, deep packet inspection would be required for network-level detection, which is often impractical. Host-based monitoring is likely to be more effective.

  • child process: /bin/sh
  • child process: /bin/bash
  • child process: powershell.exe
  • child process: cmd.exe
  • child process: wget
  • child process: curl
  • child process: nc
  • child process: ncat

What your security team should do

  • Immediately audit all PyTorch applications to identify any use of the RemoteModule or other distributed computing features.
  • Prioritize the review of network configurations for identified PyTorch servers to ensure they are not exposed to the internet or other untrusted networks.
  • Implement strict firewall rules to restrict access to PyTorch RPC ports to only a whitelist of trusted hosts.
  • Educate development teams on the security risks of deserialization and the importance of not processing untrusted data with PyTorch's distributed components.

The record

In PyTorch <=2.4.1, the RemoteModule has Deserialization RCE. NOTE: this is disputed by multiple parties because this is intended behavior in PyTorch distributed computing.

Affected packages

Ecosystem Package Introduced Fixed
PyPI torch 0 2.5.0
Bitnami pytorch 0 2.5.0
Debian:11 pytorch 0 No fix
Debian:12 pytorch 0 No fix
Debian:13 pytorch 0 No fix
Debian:14 pytorch 0 No fix
Ubuntu:22.04:LTS pytorch 0 No fix
Ubuntu:24.10 pytorch 0 No fix
Ubuntu:25.04 pytorch 0 No fix
Ubuntu:25.10 pytorch 0 No fix

Related vulnerabilities