NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · TorchServe

CVE-2023-43654: TorchServe Server-Side Request Forgery vulnerability

criticalCVSS 3.1 9.8GHSA-8fxr-qfr9-p34w

TorchServe 0.1.0 through 0.8.1 accepts model URLs from any host by default, so a remote caller can make the server download files from a URL of their choosing and write them to disk. The management API is the entry point. Release 0.8.2 adds a warning when the default allowed_urls value is used. Operators must also set allowed_urls themselves.

Published Oct 2, 2023 · Updated Nov 10, 2023 · Analysis Nov 2, 2026

What an attacker can do

TorchServe can load a model from a URL. The default configuration lacks input validation on that URL, so a third party who can reach the management interface can trigger remote HTTP download requests and have the server write the downloaded files to disk. That is server-side request forgery combined with an arbitrary file write into the model store. Model archives can contain Python handler code, so a planted archive can lead to code execution when it is loaded, though the advisory itself speaks of integrity and sensitive data compromise.

The CVSS vector (AV:N, PR:N, UI:N) scores 9.8: no login and no user action. The attacker needs network access to the TorchServe management port, which is often left open inside clusters and containers. The server can also be pointed at internal addresses.

The maintainers treat this as a configuration duty. In the advisory, the user is responsible for setting allowed_urls and for naming the model URL to use. Version 0.8.2 does not change the default. It only warns when the default is in effect.

Who is affected

The pip package torchserve from 0.1.0 up to, but not including, 0.8.2. Exposure is highest when the management API listens on a non-loopback address and allowed_urls is left at its default. Check:

pip show torchserve

Then inspect config.properties for allowed_urls and for the management address. AWS Deep Learning Container images ship TorchServe too, so check the image tag against the advisory's list.

torchserve

Ecosystem
PyPI
Affected
>= 0.1.0, < 0.8.2
Fixed in
0.8.2
Check
pip show torchserve

How to fix it

Upgrade torchserve to 0.8.2:

pip install --upgrade torchserve==0.8.2

Then set allowed_urls in config.properties to the exact locations you load models from. Version 0.8.2 logs a warning when the default is used, but the default itself is still permissive. For AWS deployments, the advisory lists patched Deep Learning Container tags, such as v1.9-pt-ec2-2.0.1-inf-gpu-py310 and v1.8-pt-ec2-2.0.1-inf-cpu-py310 for x86, and v1.7-pt-graviton-ec2-2.0.1-inf-cpu-py310 for Graviton. Keep the management API off untrusted networks.

How to tell if you were hit

Look in TorchServe logs for model registration requests to the management API that reference external or unexpected URLs, and for the 0.8.2 warning about default allowed_urls. Check the model-store directory for archives you did not deploy, and review network logs for outbound downloads from the TorchServe host to unfamiliar servers or internal addresses.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

Remote Server-Side Request Forgery (SSRF) Issue: TorchServe default configuration lacks proper input validation, enabling third parties to invoke remote HTTP download requests and write files to the disk. This issue could be taken advantage of to compromise the integrity of the system and sensitive data. This issue is present in versions 0.1.0 to 0.8.1. Mitigation: The user is able to load the model of their choice from any URL that they would like to use. The user of TorchServe is responsible for configuring both the allowed_urls and specifying the model URL to be used. A pull request to warn the user when the default value for allowed_urls is used has been merged - https://github.com/pytorch/serve/pull/2534. TorchServe release 0.8.2 includes this change.

Patches

TorchServe release 0.8.2 includes fixes to address the previously listed issue:

https://github.com/pytorch/serve/releases/tag/v0.8.2

Tags for upgraded DLC release User can use the following new image tags to pull DLCs that ship with patched TorchServe version 0.8.2: x86 GPU

  • v1.9-pt-ec2-2.0.1-inf-gpu-py310
  • v1.8-pt-sagemaker-2.0.1-inf-gpu-py310

x86 CPU

  • v1.8-pt-ec2-2.0.1-inf-cpu-py310
  • v1.7-pt-sagemaker-2.0.1-inf-cpu-py310

Graviton

  • v1.7-pt-graviton-ec2-2.0.1-inf-cpu-py310
  • v1.5-pt-graviton-sagemaker-2.0.1-inf-cpu-py310

Neuron

  • 1.13.1-neuron-py310-sdk2.13.2-ubuntu20.04
  • 1.13.1-neuronx-py310-sdk2.13.2-ubuntu20.04
  • 1.13.1-neuronx-py310-sdk2.13.2-ubuntu20.04

The full DLC image URI details can be found at: https://github.com/aws/deep-learning-containers/blob/master/available_images.md#available-deep-learning-containers-images

References

https://github.com/pytorch/serve/blob/b3eced56b4d9d5d3b8597aa506a0bcf954d291bc/docs/configuration.md?plain=1#L296 https://github.com/pytorch/serve/pull/2534 https://github.com/pytorch/serve/releases/tag/v0.8.2 https://github.com/aws/deep-learning-containers/blob/master/available_images.md#available-deep-learning-containers-images

Credit

We would like to thank Oligo Security for responsibly disclosing this issue and working with us on its resolution. If you have any questions or comments about this advisory, we ask that you contact AWS/Amazon Security via our vulnerability reporting page](https://aws.amazon.com/security/vulnerability-reporting)) or directly via email to [[email protected]](mailto:[email protected]). Please do not create a public GitHub issue.

Questions

Does upgrading to 0.8.2 close the hole by itself?

Not fully. Release 0.8.2 adds a warning when the default allowed_urls value is in use. You still have to configure allowed_urls with your own trusted locations.

Does the attacker need credentials?

The CVSS vector says no privileges and no user interaction. They need network reach to the management API.

Which versions are affected by CVE-2023-43654?

TorchServe 0.1.0 up to 0.8.1. Version 0.8.2 is the patched release.

Is it exploited in the wild?

The sources do not say so, and the entry has no CISA catalog data. Its EPSS score is high, about 0.43.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More TorchServe vulnerabilities

All TorchServe entries