7.5high
Client metadata path-traversal in python-tuf
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 1.45% (higher than 74% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-wjw6-2cqr-j4qrPYSEC-2021-376
Description
python-tuf is a Python reference implementation of The Update Framework (TUF). In both clients (`tuf/client` and `tuf/ngclient`), there is a path traversal vulnerability that in the worst case can overwrite files ending in `.json` anywhere on the client system on a call to `get_one_valid_targetinfo()`. It occurs because the rolename is used to form the filename, and may contain path traversal characters (ie `../../name.json`). The impact is mitigated by a few facts: It only affects implementations that allow arbitrary rolename selection for delegated targets metadata, The attack requires the ability to A) insert new metadata for the path-traversing role and B) get the role delegated by an existing targets metadata, The written file content is heavily restricted since it needs to be a valid, signed targets file. The file extension is always .json. A fix is available in version 0.19 or newer. There are no workarounds that do not require code changes. Clients can restrict the allowed character set for rolenames, or they can store metadata in files named in a way that is not vulnerable: neither of these approaches is possible without modifying python-tuf.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| theupdateframework python-tuf | < 0.19.0 | CVE List |
| tuf (PyPI) | before 0.19.0, before 4ad7ae48fda594b640139c3b7eae21ed5155a102 | GitHub Advisory Database, PyPA Advisory Database |
| linuxfoundation the_update_framework | up to 0.18.1 | NVD |
All scores
| GitHub_M | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:H/A:N |
| GitHub | 7.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:L/I:H/A:N |
| GitHub | medium CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:N/SC:L/SI:H/SA:N |
| NVD | 8.7high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:C/C:N/I:H/A:H |
| NVD | 8.8high CVSS:2.0 | AV:N/AC:M/Au:N/C:N/I:C/A:C |
Classification
What each source says
CVE List
python-tuf is a Python reference implementation of The Update Framework (TUF). In both clients (`tuf/client` and `tuf/ngclient`), there is a path traversal vulnerability that in the worst case can overwrite files ending in `.json` anywhere on the client system on a call to `get_one_valid_targetinfo()`. It occurs because the rolename is used to form the filename, and may contain path traversal characters (ie `../../name.json`). The impact is mitigated by a few facts: It only affects implementations that allow arbitrary rolename selection for delegated targets metadata, The attack requires the ability to A) insert new metadata for the path-traversing role and B) get the role delegated by an existing targets metadata, The written file content is heavily restricted since it needs to be a valid, signed targets file. The file extension is always .json. A fix is available in version 0.19 or newer. There are no workarounds that do not require code changes. Clients can restrict the allowed character set for rolenames, or they can store metadata in files named in a way that is not vulnerable: neither of these approaches is possible without modifying python-tuf.
GitHub Advisory Database
Impact
In both clients (tuf/client and tuf/ngclient), there is a path traversal vulnerability that in the worst case can overwrite files ending in .json anywhere on the client system on a call to get_one_valid_targetinfo(). It occurs because the rolename is used to form the filename, and may contain path traversal characters (ie ../../name.json).
The impact is mitigated by a few facts:
- It only affects implementations that allow arbitrary rolename selection for delegated targets metadata
- The attack requires the ability to A) insert new metadata for the path-traversing role and B) get the role delegated by an existing targets metadata
- The written file content is heavily restricted since it needs to be a valid, signed targets file. The file extension is always .json.
Patches
A fix is available in version 0.19 or newer.
Workarounds
None that do not require code changes. Clients can restrict the allowed character set for rolenames, or they can store metadata in files named in a way that is not vulnerable: neither of these approaches is possible without modifying python-tuf.
References
For more information
If you have any questions or comments about this advisory:
- Open an issue in python-tuf
- Contact the maintainers by email or Slack
NVD (es)
python-tuf es una implementación de referencia en Python de The Update Framework (TUF). En ambos clientes ("tuf/client" y "tuf/ngclient"), se presenta una vulnerabilidad en la ruta de acceso que, en el peor de los casos, puede sobrescribir los archivos que terminan en ".json" en cualquier parte del sistema cliente en una llamada a "get_one_valid_targetinfo()". Ocurre porque el rolename es usado para formar el nombre del archivo, y puede contener caracteres de salto de ruta (por ejemplo "../../nombre.json"). El impacto está mitigado por algunos hechos: Sólo afecta a las implementaciones que permiten la selección arbitraria de nombres de rol para los metadatos de los objetivos delegados, El ataque requiere la capacidad de A) insertar nuevos metadatos para el rol que atraviesa la ruta y B) conseguir el rol delegado por un metadato de objetivos existente, El contenido del archivo escrito está fuertemente restringido ya que necesita ser un archivo de objetivos válido y firmado. La extensión del archivo es siempre .json. Se presenta una corrección disponible en la versión 0.19 o más reciente. No se presentan soluciones que no requieran cambios en el código. Los clientes pueden restringir el conjunto de caracteres permitidos para los nombres de rol, o pueden almacenar metadatos en archivos con nombres que no sean vulnerables: ninguno de estos enfoques es posible sin modificar python-tuf
References
| https://github.com/theupdateframework/python-tuf/security/advisories/GHSA-wjw6-2cqr-j4qr | advisory, third-party-advisory, web | |
| https://github.com/theupdateframework/python-tuf/issues/1527 | issue-tracking, report, third-party-advisory, web | |
| https://github.com/theupdateframework/python-tuf/commit/4ad7ae48fda594b640139c3b7eae21ed5155a102 | fix, patch, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2021-41131 | advisory | |
| https://github.com/pypa/advisory-database/tree/main/vulns/tuf/PYSEC-2021-376.yaml | web | |
| https://github.com/theupdateframework/python-tuf | package | |
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2021-41131 changed 2024-11-18 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-wjw6-2cqr-j4qr changed 2026-07-08 | CC-BY-4.0 |
| NVD | CVE-2021-41131 changed 2026-06-17 | Public domain |
| PyPA Advisory Database | PYSEC-2021-376 changed 2025-01-14 | CC-BY-4.0 |