Rapid7 Vulnerability & Exploit Database

PyTorch Model Server Registration and Deserialization RCE

Back to Search

PyTorch Model Server Registration and Deserialization RCE



The PyTorch model server contains multiple vulnerabilities that can be chained together to permit an unauthenticated remote attacker arbitrary Java code execution. The first vulnerability is that the management interface is bound to all IP addresses and not just the loop back interface as the documentation suggests. The second vulnerability (CVE-2023-43654) allows attackers with access to the management interface to register MAR model files from arbitrary servers. The third vulnerability is that when an MAR file is loaded, it can contain a YAML configuration file that when deserialized by snakeyaml, can lead to loading an arbitrary Java class.


  • Idan Levcovich
  • Guy Kaplan
  • Gal Elbaz
  • Swapneil Kumar Dash
  • Spencer McIntyre


Module Options

To display the available options, load the module within the Metasploit console and run the commands 'show options' or 'show advanced':

msf > use exploit/multi/http/torchserver_cve_2023_43654
msf exploit(torchserver_cve_2023_43654) > show targets
msf exploit(torchserver_cve_2023_43654) > set TARGET < target-id >
msf exploit(torchserver_cve_2023_43654) > show options
    ...show and set options...
msf exploit(torchserver_cve_2023_43654) > exploit

Time is precious, so I don’t want to do something manually that I can automate. Leveraging the Metasploit Framework when automating any task keeps us from having to re-create the wheel as we can use the existing libraries and focus our efforts where it matters.

– Jim O’Gorman | President, Offensive Security