CVE-2026-141547: PDM A Project Pdm.toml Can Still Vulnerability

HIGH
Advisory Identifier: GHSA-fv38-chg5-6pg2
CVSS 7.0
CWE-15 CWE-94
Published
Advisory Summary

CVE-2026-141547 is a HIGH (CVSS 7.0) a project pdm.toml can still vulnerability (CWE-15: External Control of System or Configuration Setting) affecting PDM libraries in the PyPI ecosystem. The issue involves a project pdm.toml can still set cache_dir, which brings back project-controlled plugin code at pdm startup. Remediation is available by upgrading affected packages to version 2.29.8.

CVE-2026-141547 at a Glance

CVE Identifier CVE-2026-141547
GHSA Identifier GHSA-fv38-chg5-6pg2
Severity HIGH
CVSS v3.1 Base Score 7.0
CWE Classification CWE-15: External Control of System or Configuration Setting
Affected Product PDM
Package Ecosystem PyPI
Published Date
Last Updated

Security Impact

CVSS: 7.0

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H).

Attack Vector Local (AV:L)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-141547

To remediate this vulnerability, upgrade all affected PDM dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

pdm fixed: 2.29.8
pip install pdm>=2.29.8
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

pip show pdm

How to Check if You Are Affected

To determine whether your Python environment is affected by CVE-2026-141547, inspect your installed packages using pip:

pip show pdm

Analyze the terminal output to locate any version of PDM in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.29.8), your application is affected.

Note: The pip show pdm command checks currently installed packages in your active Python environment.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-15: External Control of System or Configuration Setting, where one or more system settings or configuration elements can be externally controlled by a user. In PDM, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

## Summary GHSA-qq6c-99pv-prvf was fixed by moving the per-project plugin library out of the project, to `<cache_dir>/plugins/<project name>-<hash>`. `cache_dir` is declared global-only, but that is checked only when a value is written. A `pdm.toml` committed to a repository (the docs recommend committing it) can still set `cache_dir`, and the plugin library path is then computed under a directory the repository controls. A repository can ship that directory with a `.pth` file, and pdm runs it at startup, before parsing arguments. In my test `pdm --version` was enough. The plugin directory name contains a hash of the absolute project path, so the repository has to guess where it will be checked out. In CI and container builds the path is usually fixed (`/app`, `/home/runner/work/<repo>/<repo>`, `/workspaces/<repo>`), and a repository can include directories for several guesses. ## Details Line numbers are for 2.29.7 (main 4d5c6216 has the same three files). - `src/pdm/project/config.py:111-115` declares `cache_dir` with `global_only=True`. The check is in `__setitem__` (`:422`); `__getitem__` (`:369-393`) returns the project file's value, and `Config.__init__` loads the project file without filtering (`:316`). - `src/pdm/project/core.py:252-256`: `Project.config` is `ChainMap(project_config, global_config)`, so the project value wins. - `src/pdm/project/core.py:121-128`: `cache_dir` is read from that config, and `project_plugins_dir` is `cache_dir / "plugins" / f"{root.name}-{sha224(normcase(str(root)))[:12]}"`. - `src/pdm/core.py:86` and `:329-350`: `Core.__init__` calls `load_plugins()`, which runs `site.addsitedir()` on that directory's `site-packages` if it exists, so `.pth` import lines execute. This is the same impact as GHSA-qq6c (fixed in 16bab5cd, 2.27.0) through a different path: the config precedence ignores `global_only`. ## PoC A project at `/tmp/app` with a minimal `pyproject.toml`, a `pdm.toml` containing `cache_dir = ".pdmcache"`, and `.pdmcache/plugins/app-<sha224("/tmp/app")[:12]>/lib/python3.12/site-packages/zz_demo.pth`, whose one `import` line writes a marker file. Then `cd /tmp/app && pdm --version`. Docker, no network, pdm 2.29.7 from PyPI (the latest release), Python 3.12: ``` PDM, version 2.29.7 [attack] pdm --version -> marker: pth executed, cmd=['/work/venv/bin/pdm', '--version'] $ pdm config cache_dir .pdmcache [control, no pdm.toml] marker: NONE ``` The same on main (`PDM, version 2.29.8.dev18`). I can post the script here. ## Impact Code execution as the user who runs pdm in an untrusted checkout, when the checkout path matches one the repository prepared and `PDM_CACHE_DIR` is not set. I showed it with `pdm --version`; since the plugin library is loaded in `Core.__init__`, other commands should behave the same, including ones that otherwise do not run project code (`pdm lock`, `pdm export`), but `--version` was only ran. The directory layout also has to match the victim's Python version (`lib/python3.12/...`), which a repository can cover by shipping several. ## Suggested fix When loading a project `pdm.toml`, ignore `global_only` keys with a warning (or skip project data for them in `__getitem__`), and compute `project_plugins_dir` from the global `cache_dir` only. A regression test: a project `pdm.toml` that sets `cache_dir` must not change `project.cache_dir` or `project_plugins_dir`. ## Notes AI tools (Claude, with a separate Codex review) were used while auditing the code and writing this report. The PoC was manually ran by the reporter. Tested 2.29.7 and main; 2.27.0 as the first affected version is inferred from 16bab5cd.

CVE-2026-141547 Affected PDM Versions

1 component(s)
Fixed Versions:
2.29.8
Product / Package Ecosystem Affected Versions Fixed Version
pdm
PyPI
≥ 2.27.0
< 2.29.8
2.29.8

References

Frequently Asked Questions

What is CVE-2026-141547?
CVE-2026-141547 is a security vulnerability in PDM involving A project pdm.toml can still set cache_dir, which brings back project-controlled plugin code at pdm startup under CWE-15: External Control of System or Configuration Setting.
Which PDM versions are affected?
Affected versions include releases prior to 2.29.8 across affected packages: pdm.
What version fixes CVE-2026-141547?
Upgrading to 2.29.8 (or the latest patched release for your respective branch) resolves the vulnerability.
Is pdm affected?
Yes, pdm is affected in releases prior to 2.29.8. Upgrade your dependency to 2.29.8 or later.
What is the CVSS score of CVE-2026-141547?
CVE-2026-141547 has a CVSS v3.1 base score of 7.0 (HIGH) with vector string CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-141547?
CVE-2026-141547 is classified under CWE-15: External Control of System or Configuration Setting (One or more system settings or configuration elements can be externally controlled by a user.).
How can I check PyPI dependencies for CVE-2026-141547?
Run the dependency tree command: 'pip show pdm'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fv38-chg5-6pg2",
  "modified" : "2026-12-04T21:49:17Z",
  "published" : "2026-12-04T21:49:17Z",
  "aliases" : [ "CVE-2026-141547" ],
  "summary" : "PDM: A project pdm.toml can still set cache_dir, which brings back project-controlled plugin code at pdm startup",
  "details" : "## Summary\n\nGHSA-qq6c-99pv-prvf was fixed by moving the per-project plugin library out of the project, to `<cache_dir>/plugins/<project name>-<hash>`. `cache_dir` is declared global-only, but that is checked only when a value is written. A `pdm.toml` committed to a repository (the docs recommend committing it) can still set `cache_dir`, and the plugin library path is then computed under a directory the repository controls. A repository can ship that directory with a `.pth` file, and pdm runs it at startup, before parsing arguments. In my test `pdm --version` was enough.\n\nThe plugin directory name contains a hash of the absolute project path, so the repository has to guess where it will be checked out. In CI and container builds the path is usually fixed (`/app`, `/home/runner/work/<repo>/<repo>`, `/workspaces/<repo>`), and a repository can include directories for several guesses.\n\n## Details\n\nLine numbers are for 2.29.7 (main 4d5c6216 has the same three files).\n\n- `src/pdm/project/config.py:111-115` declares `cache_dir` with `global_only=True`. The check is in `__setitem__` (`:422`); `__getitem__` (`:369-393`) returns the project file's value, and `Config.__init__` loads the project file without filtering (`:316`).\n- `src/pdm/project/core.py:252-256`: `Project.config` is `ChainMap(project_config, global_config)`, so the project value wins.\n- `src/pdm/project/core.py:121-128`: `cache_dir` is read from that config, and `project_plugins_dir` is `cache_dir / \"plugins\" / f\"{root.name}-{sha224(normcase(str(root)))[:12]}\"`.\n- `src/pdm/core.py:86` and `:329-350`: `Core.__init__` calls `load_plugins()`, which runs `site.addsitedir()` on that directory's `site-packages` if it exists, so `.pth` import lines execute.\n\nThis is the same impact as GHSA-qq6c (fixed in 16bab5cd, 2.27.0) through a different path: the config precedence ignores `global_only`.\n\n## PoC\n\nA project at `/tmp/app` with a minimal `pyproject.toml`, a `pdm.toml` containing `cache_dir = \".pdmcache\"`, and `.pdmcache/plugins/app-<sha224(\"/tmp/app\")[:12]>/lib/python3.12/site-packages/zz_demo.pth`, whose one `import` line writes a marker file. Then `cd /tmp/app && pdm --version`. Docker, no network, pdm 2.29.7 from PyPI (the latest release), Python 3.12:\n\n```\nPDM, version 2.29.7\n[attack] pdm --version -> marker: pth executed, cmd=['/work/venv/bin/pdm', '--version']\n$ pdm config cache_dir\n.pdmcache\n[control, no pdm.toml] marker: NONE\n```\n\nThe same on main (`PDM, version 2.29.8.dev18`). I can post the script here.\n\n## Impact\n\nCode execution as the user who runs pdm in an untrusted checkout, when the checkout path matches one the repository prepared and `PDM_CACHE_DIR` is not set. I showed it with `pdm --version`; since the plugin library is loaded in `Core.__init__`, other commands should behave the same, including ones that otherwise do not run project code (`pdm lock`, `pdm export`), but `--version` was only ran. The directory layout also has to match the victim's Python version (`lib/python3.12/...`), which a repository can cover by shipping several.\n\n## Suggested fix\n\nWhen loading a project `pdm.toml`, ignore `global_only` keys with a warning (or skip project data for them in `__getitem__`), and compute `project_plugins_dir` from the global `cache_dir` only. A regression test: a project `pdm.toml` that sets `cache_dir` must not change `project.cache_dir` or `project_plugins_dir`.\n\n## Notes\n\nAI tools (Claude, with a separate Codex review) were used while auditing the code and writing this report. The PoC was manually ran by the reporter. Tested 2.29.7 and main; 2.27.0 as the first affected version is inferred from 16bab5cd.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "PyPI",
      "name" : "pdm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "2.27.0"
      }, {
        "fixed" : "2.29.8"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/pdm-project/pdm/security/advisories/GHSA-fv38-chg5-6pg2"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-141547"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pdm-project/pdm/commit/8cfea30571b0694dacbc7c5e4459527f83a4c4cc"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/pdm-project/pdm"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/pdm-project/pdm/releases/tag/2.29.8"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-15", "CWE-94" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-04T21:49:17Z",
    "nvd_published_at" : "2026-12-02T19:18:01Z"
  }
}