CVE-2025-55214: Copier Copier's Safe Template Has Filesystem Vulnerability
MODERATECVE-2025-55214 is a MODERATE copier's safe template has filesystem vulnerability (CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')) affecting Copier libraries in the PyPI ecosystem. The issue involves copier's safe template has filesystem write access outside destination path. Remediation is available by upgrading affected packages to version 9.9.1.
CVE-2025-55214 at a Glance
How to Fix CVE-2025-55214
To remediate this vulnerability, upgrade all affected Copier dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install copier>=9.9.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show copier
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2025-55214, inspect your installed packages using pip:
pip show copier
Analyze the terminal output to locate any version of Copier in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 9.9.1), your application is affected.
Note: The pip show copier command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal'), where the product uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the product does not properly neutralize special elements within the pathname that can cause the pathname to resolve to a location that is outside of the restricted directory. In Copier, 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
CVE-2025-55214 Affected Copier Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
copier
|
PyPI |
≥ 7.1.0
< 9.9.1
|
9.9.1
|
References
Frequently Asked Questions
What is CVE-2025-55214?
Which Copier versions are affected?
What version fixes CVE-2025-55214?
Is copier affected?
What CWE is associated with CVE-2025-55214?
How can I check PyPI dependencies for CVE-2025-55214?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-p7q8-grrj-3m8w",
"modified" : "2025-08-18T21:01:07Z",
"published" : "2025-08-18T21:01:07Z",
"aliases" : [ "CVE-2025-55214" ],
"summary" : "Copier's safe template has filesystem write access outside destination path",
"details" : "### Impact\n\nCopier suggests that it's safe to generate a project from a safe template, i.e. one that doesn't use [unsafe](https://copier.readthedocs.io/en/stable/configuring/#unsafe) features like custom Jinja extensions which would require passing the `--UNSAFE,--trust` flag. As it turns out, a safe template can currently write files outside the destination path where a project shall be generated or updated. This is possible when rendering a [generated directory structure](https://copier.readthedocs.io/en/stable/configuring/#generating-a-directory-structure) whose rendered path is either a relative parent path or an absolute path. Constructing such paths is possible using Copier's builtin `pathjoin` Jinja filter and its builtin `_copier_conf.sep` variable, which is the platform-native path separator. This way, a malicious template author can create a template that overwrites arbitrary files (according to the user's write permissions), e.g., to cause havoc.\n\n#### Write access via generated relative path\n\nReproducible example:\n\n```shell\necho \"foo\" > forbidden.txt\nmkdir src/\necho \"bar\" > \"src/{{ pathjoin('..', 'forbidden.txt') }}\"\nuvx copier copy src/ dst/\ncat forbidden.txt\n```\n\n#### Write access via generated absolute path\n\nReproducible example:\n\n- POSIX:\n\n ```shell\n # Assumption: The current working directory is `/tmp/test-copier-vulnerability/`\n echo \"foo\" > forbidden.txt\n mkdir src/\n echo \"bar\" > \"src/{{ pathjoin(_copier_conf.sep, 'tmp', 'test-copier-vulnerability', 'forbidden.txt') }}\"\n uvx --from copier python -O -m copier copy --overwrite src/ dst/\n cat forbidden.txt\n ```\n\n- Windows (PowerShell):\n\n ```powershell\n # Assumption: The current working directory is `C:\\Users\\<user>\\Temp\\test-copier-vulnerability`\n echo \"foo\" > forbidden.txt\n mkdir src\n Set-Content -Path src\\copier.yml @'\n drive:\n type: str\n default: \"C:\"\n when: false\n '@\n echo \"bar\" > \"src\\{{ pathjoin(drive, 'Users', '<user>', 'Temp', 'test-copier-vulnerability', 'forbidden.txt') }}\"\n uvx --from copier python -O -m copier copy --overwrite src dst\n cat forbidden.txt\n ```\n\nThis scenario is slightly less severe, as Copier has a few [assertions of the destination path being relative](https://github.com/copier-org/copier/blob/d106ea543fd26e1ac1b9a3dcef3e99cc70fdf57c/copier/_main.py#L747) which would typically be raised. But `python -O` (or `PYTHONOPTIMIZE=x`) removes asserts, so these guards may be ineffective. In addition, this scenario will prompt for overwrite confirmation or require the `--overwrite` flag for non-interactive mode; yet malicious file writes might go unnoticed.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:N/VI:H/VA:H/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "copier"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "7.1.0"
}, {
"fixed" : "9.9.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/copier-org/copier/security/advisories/GHSA-p7q8-grrj-3m8w"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2025-55214"
}, {
"type" : "WEB",
"url" : "https://github.com/copier-org/copier/commit/fdbc0167cc22780b497e4db176feaf6f024757d6"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/copier-org/copier"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-22" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2025-08-18T21:01:07Z",
"nvd_published_at" : "2025-08-18T17:15:30Z"
}
}