# CVE-2021-41149: Improper sanitization of target names in tough

> Attackers can overwrite arbitrary files on the system by exploiting improper sanitization of target names in the tough library.

- **Severity:** High 8.2 (`CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:C/C:H/I:H/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 19 Oct 2021
- **Updated:** 4 Aug 2024
- **Also known as:** GHSA-x3r5-q6mj-m485

## What is CVE-2021-41149?

CVE-2021-41149 is a high-severity path traversal vulnerability in awslabs tough, published on 19 Oct 2021. Any signed-in user can exploit it over the network, with no action from the victim.

### Official description

Tough provides a set of Rust libraries and tools for using and generating the update framework (TUF) repositories. The tough library, prior to 0.12.0, does not properly sanitize target names when caching a repository, or when saving specific targets to an output directory. When targets are cached or saved, files could be overwritten with arbitrary content anywhere on the system. A fix is available in version 0.12.0. No workarounds to this issue are known.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2021-41149?

2 open source packages ship an affected version, including tough. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `tough` | crates.io | All versions | 0.12.0 |
| `tough` | crates.io | All versions | 0.12.0 |

Products: Amazon Tough.

## How do I fix CVE-2021-41149?

Upgrade tough to 0.12.0 or later.

## Is CVE-2021-41149 being exploited?

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

## Other vulnerabilities in awslabs tough

- [CVE-2020-15093](https://insights.sbomify.com/CVE-2020-15093/): Improper verification of signature threshold in tough (high 8.6)
- [CVE-2021-41150](https://insights.sbomify.com/CVE-2021-41150/): Improper sanitization of delegated role names in tough (high 8.2)
- [CVE-2026-6967](https://insights.sbomify.com/CVE-2026-6967/): Missing Delegated Metadata Validation in awslabs/tough (high 7.1)
- [CVE-2026-6968](https://insights.sbomify.com/CVE-2026-6968/): Multiple Path Traversal Variants in awslabs/tough (high 7.1)
- [CVE-2026-6966](https://insights.sbomify.com/CVE-2026-6966/): Signature Threshold Bypass in awslabs/tough Delegated Roles (high 7.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2021-41149 and fix it if it is affected.

What it is: CVE-2021-41149 is a high-severity path traversal vulnerability in awslabs tough, published on 19 Oct 2021. Any signed-in user can exploit it over the network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2021-41149 in the wild and no public exploit code.

Affected packages and fixed versions:
- tough (crates.io): affected all versions; fixed in 0.12.0
- tough (crates.io): affected all versions; fixed in 0.12.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-2021-41149/ (Markdown: https://insights.sbomify.com/CVE-2021-41149/index.md)
```

## Sources

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

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