CVE-2026-141547
PDM: A project pdm. toml can still set cache_ dir, which brings back project- controlled plugin code at pdm startup (PyPI)
- Severity
- 7.0HighLocal attack, no privileges, needs user interactionCVSS 3.1, CVE List
- Exploitation
- Proof of conceptCISA reports one, no source links it
- Exploit chance
- 0.47% in 30 daysPercentile42ndEPSS, scored
- Listed fix
2.29.8for pdmFrom GitHub Advisories
Overview
PDM is a Python package and dependency manager. From 2.27.0 until 2.29.8, a repository-controlled pdm.toml can override the global_only setting cache_dir because src/pdm/project/config.py enforces the restriction on writes but not when project configuration is read. In src/pdm/project/core.py, Project.config gives the project value precedence and project_plugins_dir is computed beneath the resulting cache directory. During Core.init in src/pdm/core.py, load_plugins calls site.addsitedir on that directory's site-packages, processing executable .pth import lines before argument parsing. A malicious checkout can therefore execute Python code as the invoking user when PDM runs, including for pdm --version, if the prepared plugin directory matches the checkout path and Python version and PDM_CACHE_DIR is not set. This bypasses the earlier relocation of project plugins out of the checkout for CVE-2026-47781. This issue is fixed in version 2.29.8.
CVSS 3.1 vector
Exploitability
- Attack vector
- Local
- Complexity
- High
- Privileges needed
- None
- User interaction
- Required
Impact
- Scope
- Unchanged
- Confidentiality
- High
- Integrity
- High
- Availability
- High
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:HExploit chance over time
Sources
CVE List Score usedCVSS 3.17.0
PDM: A project pdm.toml can still set cache_dir, which brings back project-controlled plugin code at pdm startup
PDM is a Python package and dependency manager. From 2.27.0 until 2.29.8, a repository-controlled pdm.toml can override the global_only setting cache_dir because src/pdm/project/config.py enforces the restriction on writes but not when project configuration is read. In src/pdm/project/core.py, Project.config gives the project value precedence and project_plugins_dir is computed beneath the resulting cache directory. During Core.init in src/pdm/core.py, load_plugins calls site.addsitedir on that directory's site-packages, processing executable .pth import lines before argument parsing. A malicious checkout can therefore execute Python code as the invoking user when PDM runs, including for pdm --version, if the prepared plugin directory matches the checkout path and Python version and PDM_CACHE_DIR is not set. This bypasses the earlier relocation of project plugins out of the checkout for CVE-2026-47781. This issue is fixed in version 2.29.8.
- Record
CVE-2026-141547- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-15, CWE-94
- Updated
- 2026-12-02
EUVDEUVD-2026-141814CVSS 3.17.0
PDM is a Python package and dependency manager. From 2.27.0 until 2.29.8, a repository-controlled pdm.toml can override the global_only setting cache_dir because src/pdm/project/config.py enforces the restriction on writes but not when project configuration is read. In src/pdm/project/core.py, Project.config gives the project value precedence and project_plugins_dir is computed beneath the resulting cache directory. During Core.init in src/pdm/core.py, load_plugins calls site.addsitedir on that directory's site-packages, processing executable .pth import lines before argument parsing. A malicious checkout can therefore execute Python code as the invoking user when PDM runs, including for pdm --version, if the prepared plugin directory matches the checkout path and Python version and PDM_CACHE_DIR is not set. This bypasses the earlier relocation of project plugins out of the checkout for CVE-2026-47781. This issue is fixed in version 2.29.8.
- Record
EUVD-2026-141814- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Updated
- 2026-12-02
GitHub AdvisoriesGHSA-fv38-chg5-6pg2CVSS 3.17.0
PDM: A project pdm.toml can still set cache_dir, which brings back project-controlled plugin code at pdm startup
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-115declarescache_dirwithglobal_only=True. The check is in__setitem__(:422);__getitem__(:369-393) returns the project file's value, andConfig.__init__loads the project file without filtering (:316).src/pdm/project/core.py:252-256:Project.configisChainMap(project_config, global_config), so the project value wins.src/pdm/project/core.py:121-128:cache_diris read from that config, andproject_plugins_diriscache_dir / "plugins" / f"{root.name}-{sha224(normcase(str(root)))[:12]}".src/pdm/core.py:86and:329-350:Core.__init__callsload_plugins(), which runssite.addsitedir()on that directory'ssite-packagesif it exists, so.pthimport 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.
- Record
GHSA-fv38-chg5-6pg2- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-15, CWE-94
- Updated
- 2026-12-04
NVDCVSS 3.17.0
PDM is a Python package and dependency manager. From 2.27.0 until 2.29.8, a repository-controlled pdm.toml can override the global_only setting cache_dir because src/pdm/project/config.py enforces the restriction on writes but not when project configuration is read. In src/pdm/project/core.py, Project.config gives the project value precedence and project_plugins_dir is computed beneath the resulting cache directory. During Core.init in src/pdm/core.py, load_plugins calls site.addsitedir on that directory's site-packages, processing executable .pth import lines before argument parsing. A malicious checkout can therefore execute Python code as the invoking user when PDM runs, including for pdm --version, if the prepared plugin directory matches the checkout path and Python version and PDM_CACHE_DIR is not set. This bypasses the earlier relocation of project plugins out of the checkout for CVE-2026-47781. This issue is fixed in version 2.29.8.
- Record
CVE-2026-141547- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-15, CWE-94
- Updated
- 2026-12-03
OSVCVSS 3.17.0
PDM: A project pdm.toml can still set cache_dir, which brings back project-controlled plugin code at pdm startup
PDM is a Python package and dependency manager. From 2.27.0 until 2.29.8, a repository-controlled pdm.toml can override the global_only setting cache_dir because src/pdm/project/config.py enforces the restriction on writes but not when project configuration is read. In src/pdm/project/core.py, Project.config gives the project value precedence and project_plugins_dir is computed beneath the resulting cache directory. During Core.init in src/pdm/core.py, load_plugins calls site.addsitedir on that directory's site-packages, processing executable .pth import lines before argument parsing. A malicious checkout can therefore execute Python code as the invoking user when PDM runs, including for pdm --version, if the prepared plugin directory matches the checkout path and Python version and PDM_CACHE_DIR is not set. This bypasses the earlier relocation of project plugins out of the checkout for CVE-2026-47781. This issue is fixed in version 2.29.8.
- Record
CVE-2026-141547- CVSS 3.1
- 7.0 High
CVSS:3.1/AV:L/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H - Weakness
- CWE-15, CWE-94
- Updated
- 2026-12-03
History
Recorded by Every CVE
| Day | Changed | Sources |
|---|---|---|
| Affected packages, key facts, references | GitHub Advisories, NVD, OSV | |
| Key facts, references | CVE List | |
| Other IDs, references | OSV | |
| Other IDs, published date | EUVD, NVD | |
| First indexed | CVE List |
Upstream dates may differ.
References
github.com/pdm-project/pdm/security/advisories/GHSA-fv38-chg5-6pg2
github.com/pdm-project/pdm/commit/8cfea30571b0694dacbc7c5e4459527f83a4c4cc
github.com/pdm-project/pdm/releases/tag/2.29.8
nvd.nist.gov/vuln/detail/CVE-2026-141547
github.com/advisories/GHSA-fv38-chg5-6pg2
github.com/CVEProject/cvelistV5/tree/main/cves/2026/141xxx/CVE-2026-141547.json