CVE-2023-45805
JSON

7.8high

Trojan Lockfilein pdm

Severity
7.8high CVSS:3.1 by GitHub_M
Exploit likelihood
0.45% (higher than 40% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M
Also known as
GHSA-j44v-mmf2-xvm9PYSEC-2026-1763

Description

pdm is a Python package and dependency manager supporting the latest PEP standards. It's possible to craft a malicious `pdm.lock` file that could allow e.g. an insider or a malicious open source project to appear to depend on a trusted PyPI project, but actually install another project. A project `foo` can be targeted by creating the project `foo-2` and uploading the file `foo-2-2.tar.gz` to pypi.org. PyPI will see this as project `foo-2` version `2`, while PDM will see this as project `foo` version `2-2`. The version must only be `parseable as a version` and the filename must be a prefix of the project name, but it's not verified to match the version being installed. Version `2-2` is also not a valid normalized version per PEP 440. Matching the project name exactly (not just prefix) would fix the issue. When installing dependencies with PDM, what's actually installed could differ from what's listed in `pyproject.toml` (including arbitrary code execution on install). It could also be used for downgrade attacks by only changing the version. This issue has been addressed in commit `6853e2642df` which is included in release version `2.9.4`. Users are advised to upgrade. There are no known workarounds for this vulnerability.

Affected

Product or packageVersionsReported by
pdm-project pdm>= 2.0.0,< 2.9.4CVE List
frostming pdmfrom 2.0.0 before 2.10.0CVE List, NVD
frostming unearthbefore 0.11.2CVE List, NVD
pdm (PyPI)up to 2.9.3, before 2.10.0GitHub Advisory Database, PyPA Advisory Database

All scores

GitHub_M7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
GitHub7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
NVD7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
PyPA Advisory Database7.8high CVSS:3.1CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

Classification

CWE-20

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

pdm is a Python package and dependency manager supporting the latest PEP standards. It's possible to craft a malicious `pdm.lock` file that could allow e.g. an insider or a malicious open source project to appear to depend on a trusted PyPI project, but actually install another project. A project `foo` can be targeted by creating the project `foo-2` and uploading the file `foo-2-2.tar.gz` to pypi.org. PyPI will see this as project `foo-2` version `2`, while PDM will see this as project `foo` version `2-2`. The version must only be `parseable as a version` and the filename must be a prefix of the project name, but it's not verified to match the version being installed. Version `2-2` is also not a valid normalized version per PEP 440. Matching the project name exactly (not just prefix) would fix the issue. When installing dependencies with PDM, what's actually installed could differ from what's listed in `pyproject.toml` (including arbitrary code execution on install). It could also be used for downgrade attacks by only changing the version. This issue has been addressed in commit `6853e2642df` which is included in release version `2.9.4`. Users are advised to upgrade. There are no known workarounds for this vulnerability.

GitHub Advisory Database
Summary

It's possible to craft a malicious pdm.lock file that could allow e.g. an insider or a malicious open source project to appear to depend on a trusted PyPI project, but actually install another project.

Details

Project foo can be targeted by creating the project foo-2 and uploading the file foo-2-2.tar.gz to pypi.org. PyPI will see this as project foo-2 version 2, while PDM will see this as project foo version 2-2. The version must only be parseable as a version (and the filename must be a prefix of the project name), but it's not verified to match the version being installed. (Version 2-2 is also not a valid normalized version per PEP 440.)

Matching the project name exactly (not just prefix) would fix the issue. The version should also be verified to avoid version downgrade attacks.

PoC

Example pdm.lock snippet to appear to depend on foo but actually install foo-2

"foo 2.2.0" = [
  url = "https://files.pythonhosted.org/.../foo-2-2.tar.gz
]
Impact

When installing dependencies with PDM, what's actually installed could differ from what's listed in pyproject.toml (including arbitrary code execution on install). It could also be used for downgrade attacks by only changing the version.

NVD (es)

pdm es un administrador de dependencias y paquetes de Python que admite los últimos estándares PEP. Es posible crear un archivo `pdm.lock` malicioso que podría permitir, por ejemplo, que un proyecto interno o de código abierto malicioso parezca depender de un proyecto PyPI confiable, pero en realidad instale otro proyecto. Se puede apuntar a un proyecto `foo` creando el proyecto `foo-2` y cargando el archivo `foo-2-2.tar.gz` en pypi.org. PyPI verá esto como proyecto `foo-2` versión `2`, mientras que PDM verá esto como proyecto `foo` versión `2-2`. La versión solo debe ser "analizable como versión" y el nombre del archivo debe ser un prefijo del nombre del proyecto, pero no se verifica que coincida con la versión que se está instalando. La versión `2-2` tampoco es una versión normalizada válida según PEP 440. Hacer coincidir exactamente el nombre del proyecto (no solo el prefijo) solucionaría el problema. Al instalar dependencias con PDM, lo que realmente se instala puede diferir de lo que aparece en `pyproject.toml` (incluida la ejecución de código arbitrario durante la instalación). También podría usarse para ataques de degradación cambiando solo la versión. Este problema se solucionó en el commit `6853e2642df` que se incluye en la versión `2.9.4`. Se recomienda a los usuarios que actualicen. No se conocen workarounds para esta vulnerabilidad.

References

Sources

SourceRecordLicence
CVE ListCVE-2023-45805 changed 2024-09-12CVE Terms of Use
GitHub Advisory DatabaseGHSA-j44v-mmf2-xvm9 changed 2026-07-07CC-BY-4.0
NVDCVE-2023-45805 changed 2026-06-17Public domain
PyPA Advisory DatabasePYSEC-2026-1763 changed 2026-07-07CC-BY-4.0