
SonicWall Capture Lab's threat research team became aware of the threat CVE-2023-43654, assessed its impact and developed mitigation measures for this vulnerability.
CVE-2023-43654 is a critical server-side request forgery flaw in PyTorch TorchServe affecting versions 0.1.0 through 0.8.1, letting unauthenticated attackers supply arbitrary model URLs so the management API downloads attacker-controlled archives and executes code on the host. Classified under CWE-918 and rated 9.8 on the CVSS 3.1 scale, the bug has a 92.37 percent EPSS likelihood, signaling that exploitation in the wild is highly probable. The root cause is TorchServe’s permissive allowed_urls default, which turns the service into an internal proxy capable of fetching malicious content, leaking network metadata, or overwriting local files, jeopardizing model integrity and broader system security. Disclosed on 28 September 2023, the issue is documented in the NVD entry, which notes how a crafted .mar file can pivot the SSRF into remote code execution. Users should upgrade immediately to v0.8.2, which implements a warning for unsafe defaults and tightens input validation (GitHub advisory, PR #2534, release notes); no effective workarounds exist.
TorchServe’s management API accepts a URL parameter when registering a workflow; because this value is not validated, the service performs an unauthenticated HTTP GET for any address supplied and unpacks the returned archive into its working directory, exposing the host to attacker-controlled content.

Inside the archive, TorchServe looks for a YAML specification that it deserializes with SnakeYAML. An attacker crafted custom java class can embed a !!javax.script.ScriptEngineManager object configured with a java.net.URLClassLoader that points back to the attacker’s web server, forcing the JVM to extend its class-search path to remote resources.

Java’s Service Provider Interface then requests META-INF/services/javax.script.ScriptEngineFactory, reads the class name listed inside, and fetches the corresponding byte-code (for example, Exploit.class). When that class is loaded, its static initializer executes with the same privileges as TorchServe, giving the adversary full remote code execution.

Exploitation involves supplying a workflow whose YAML payload drives SnakeYAML and Java’s SPI to load attacker code:
The demonstration video shows the exploit chain in action: after submitting a single workflow-registration request that references evil.war, the vulnerable TorchServe instance reaches out to the attacker’s host, downloads the archive, and follows the SnakeYAML-to-Java-SPI chain until it silently loads Exploit.class. Moments later the terminal on the attacker’s machine lights up with a reverse shell prompt running under the same user that launched TorchServe, confirming full remote code execution. The clip highlights how quickly an unauthenticated adversary can pivot from an external HTTP request to interactive control of the server with no credentials, additional vulnerabilities, or social engineering required.
Figure 4: Demo Video: Remote shell gained on a vulnerable TorchServe host
To ensure SonicWall customers are prepared for any exploitation that may occur due to this vulnerability, the following signatures have been released:
The risks posed by CVE-2023-43654 can be mitigated or eliminated by:
GitHub Security Advisory
Pull Request #2534
TorchServe v0.8.2 Release Notes
National Vulnerability Database (NVD) Entry
CWE-918: Server-Side Request Forgery
CVSS v3.1 Calculator
EPSS Score History
Share This Article

An Article By
An Article By
Security News
Security News