# CVE-2024-34073: Command Injection in sagemaker-python-sdk

> Command injection in sagemaker-python-sdk allows remote code execution and denial of service if the requirements_path parameter is improperly controlled.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 3 May 2024
- **Updated:** 2 Aug 2024
- **Also known as:** GHSA-7pc3-pr3q-58vg, PYSEC-2026-1887

## What is CVE-2024-34073?

CVE-2024-34073 is a high-severity command injection vulnerability in aws sagemaker-python-sdk, published on 3 May 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

sagemaker-python-sdk is a library for training and deploying machine learning models on Amazon SageMaker. In affected versions the capture_dependencies function in `sagemaker.serve.save_retrive.version_1_0_0.save.utils` module allows for potentially unsafe Operating System (OS) Command Injection if inappropriate command is passed as the “requirements_path” parameter. This consequently may allow an unprivileged third party to cause remote code execution, denial of service, affecting both confidentiality and integrity. This issue has been addressed in version 2.214.3. Users are advised to upgrade. Users unable to upgrade should not override the “requirements_path” parameter of capture_dependencies function in `sagemaker.serve.save_retrive.version_1_0_0.save.utils`, and instead use the default value.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command)

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

3 open source packages ship an affected version, including sagemaker.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `sagemaker` | PyPI | All versions | 2.214.3 |
| `sagemaker` | PyPI | All versions | 2.214.3 |
| `sagemaker` | PyPI | All versions | 2.214.3 |

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

Upgrade sagemaker to 2.214.3 or later.

## Is CVE-2024-34073 being exploited?

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

## Fix prompt for AI coding agents

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

What it is: CVE-2024-34073 is a high-severity command injection vulnerability in aws sagemaker-python-sdk, published on 3 May 2024. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2024-34073 in the wild and no public exploit code.

Affected packages and fixed versions:
- sagemaker (PyPI): affected all versions; fixed in 2.214.3
- sagemaker (PyPI): affected all versions; fixed in 2.214.3
- sagemaker (PyPI): affected all versions; fixed in 2.214.3

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-34073/ (Markdown: https://insights.sbomify.com/CVE-2024-34073/index.md)
```

## Sources

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

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