# CVE-2024-35199: TorchServe gRPC Port Exposure

> TorchServe exposes gRPC ports on all network interfaces by default, allowing unauthorized access to model serving interfaces.

- **Severity:** High 8.2 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:N/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Jul 2024
- **Updated:** 7 Aug 2024
- **Also known as:** GHSA-hhpg-v63p-wp7w, PYSEC-2026-1971

## What is CVE-2024-35199?

CVE-2024-35199 is a high-severity vulnerability in pytorch serve, published on 18 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

TorchServe is a flexible and easy-to-use tool for serving and scaling PyTorch models in production. In affected versions the two gRPC ports 7070 and 7071, are not bound to [localhost](http://localhost/) by default, so when TorchServe is launched, these two interfaces are bound to all interfaces. Customers using PyTorch inference Deep Learning Containers (DLC) through Amazon SageMaker and EKS are not affected. This issue in TorchServe has been fixed in PR #3083. TorchServe release 0.11.0 includes the fix to address this vulnerability. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Weakness: CWE-668 (Exposure of Resource to Wrong Sphere)

## Which versions are affected by CVE-2024-35199?

3 open source packages ship an affected version, including torchserve. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `torchserve` | PyPI | From 0.3.0 | 0.11.0 |
| `torchserve` | PyPI | From 0.3.0 | 0.11.0 |
| `torchserve` | PyPI | From 0.3.0 | 0.11.0 |

Products: Pytorch Torchserve.

## How do I fix CVE-2024-35199?

Upgrade torchserve to 0.11.0 or later.

## Is CVE-2024-35199 being exploited?

There is no known exploitation of CVE-2024-35199 in the wild and no public exploit code.

## Other vulnerabilities in pytorch serve

- [CVE-2023-43654](https://insights.sbomify.com/CVE-2023-43654/): TorchServe Server-Side Request Forgery (critical 10.0)
- [CVE-2024-35198](https://insights.sbomify.com/CVE-2024-35198/): TorchServe bypass allowed_urls configuration (critical 9.8)
- [CVE-2023-48299](https://insights.sbomify.com/CVE-2023-48299/): TorchServe ZipSlip (medium 5.3)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-35199 and fix it if it is affected.

What it is: CVE-2024-35199 is a high-severity vulnerability in pytorch serve, published on 18 Jul 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2024-35199 in the wild and no public exploit code.

Affected packages and fixed versions:
- torchserve (PyPI): affected from 0.3.0; fixed in 0.11.0
- torchserve (PyPI): affected from 0.3.0; fixed in 0.11.0
- torchserve (PyPI): affected from 0.3.0; fixed in 0.11.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2024-35199/ (Markdown: https://insights.sbomify.com/CVE-2024-35199/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2024-35199
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2024-35199
- OSV: https://osv.dev/vulnerability/CVE-2024-35199

---
From sbomify Insights: https://insights.sbomify.com/CVE-2024-35199/
Summaries are generated and may contain mistakes; the official description above is the record.
