Shelltorch Explained: Multiple Vulnerabilities in Pytorch Model Server (Torchserve) (CVSS 9.9, CVSS 9.8) Walkthrough
TorchServe's default configuration exposed the management API without authentication and allowed fetching model archives from any URL, enabling an attacker to upload a malicious model that led to remote code execution. The report also describes a Java deserialization flaw in YAML parsing and a ZipSlip path traversal that could be used to overwrite files.
Want the deep dive, full story with technical walkthrough for the PyTorch (TorchServe) ShellTorch vulnerabilities CVE-2023-43654 (CVSS: 9.8) and CVE-2022-1471(CVSS: 9.9)? You’re in the right place.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the default configuration bound the management API to all network interfaces without authentication and allowed arbitrary remote URLs for model downloads, combined with unsafe YAML deserialization and missing path checks during archive extraction.
Impact
An attacker could gain complete, unauthorized access to the server, execute arbitrary code, exfiltrate sensitive data, and alter AI models.
What the attacker needed
TorchServe with default configuration; Management API exposed to attacker; Attacker can host a malicious model archive
The fix
The vulnerabilities were fixed by changing the default configuration to bind the management API to localhost, restricting allowed URLs, using SafeConstructor for YAML parsing, and adding path checks during archive extraction.
How it was found
- Start a TorchServe instance using the default configuration from the official documentation.
- Observe that the management interface is exposed on all interfaces, not just localhost.
- Use the unauthenticated management API to register a new workflow from a remote URL.
- Host a malicious model archive containing a crafted YAML file that triggers unsafe deserialization.
- The server downloads and processes the archive, executing the attacker's code.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
TorchServe is a tool for running AI models. By default, it left a powerful control panel open to anyone on the internet without a password, and it let that panel download model files from any web address. An attacker could point it at their own malicious model file, which the server would then run, giving the attacker control of the server.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.