CVE-2026-47781: pdm-project PDM code execution via project-local plugins

CVE-2026-47781 · Severity: high · CVSS 4 · Published 2026-08-04

PDM, a popular Python package and dependency manager, is vulnerable to arbitrary code execution when running commands within a malicious project directory. An attacker can include a hidden configuration file in a repository that PDM will automatically execute before performing any requested actions. This could allow an attacker to steal credentials, tamper with code, or gain persistent access to a developer's machine or CI/CD environment if they simply run a basic command like 'pdm --version' inside the untrusted folder.

Technologies: pdm (PyPI). Vendors: PyPI.

Quick answers

Is CVE-2026-47781 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-47781 being exploited in the wild.
How severe is CVE-2026-47781?
High severity, with a CVSS score of 4, published 4 August 2026.
Which products and versions are affected?
pdm (PyPI) <= 2.26.9, ECOSYSTEM:introduced=0,fixed=2.27.0.
Is there a fix for CVE-2026-47781?
Yes. pdm (PyPI): upgrade to 2.27.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-47781 attacked?
It is attacked with local access, in a software library.
Am I affected by CVE-2026-47781?
Check whether you run pdm (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • pdm (PyPI): upgrade to 2.27.0 or later
    pip install "pdm>=2.27.0"

Technical details

A code injection vulnerability exists in PDM due to the way it handles project-local plugins during Core initialization. The `load_plugins()` function calls `_add_project_plugins_library()`, which utilizes `site.addsitedir()` to add the `.pdm-plugins` directory to the Python path. On CPython, `site.addsitedir()` automatically processes `.pth` files, executing any lines starting with 'import'. Because this occurs before CLI command parsing, an attacker can achieve arbitrary code execution with the privileges of the invoking user by placing a malicious `.pth` file in a project repository. This requires the victim to run any PDM command (even low-impact ones like `--version`) within the malicious directory. The issue is fixed in version 2.27.0.

Affected products

  • pdm-project pdm <= 2.26.9

Identifiers

  • CVE-2026-47781
  • GHSA-qq6c-99pv-prvf
  • PYSEC-2026-2863

Timeline

  • 2026-05-21: disclosed
  • 2026-06-11: advisory: GitHub Advisory published
  • 2026-06-11: patched: Version 2.27.0 released

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.