# CVE-2026-34726: Copier `_subdirectory` allows template root escape via parent-directory traversal

> Attackers can use parent-directory traversal in the _subdirectory setting to escape the template root and render files from outside the intended directory.

- **Severity:** Medium 4.4 (`CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:L/I:L/A:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 2 Apr 2026
- **Updated:** 3 Apr 2026
- **Also known as:** GHSA-85v3-4m8g-hrh6, PYSEC-2026-2134

## What is CVE-2026-34726?

CVE-2026-34726 is a medium-severity path traversal vulnerability in copier-org copier, published on 2 Apr 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

### Official description

Copier is a library and CLI app for rendering project templates. Prior to version 9.14.1, Copier's _subdirectory setting is documented as the subdirectory to use as the template root. However, the current implementation accepts parent-directory traversal such as .. and uses it directly when selecting the template root. As a result, a template can escape its own directory and make Copier render files from the parent directory without --UNSAFE. This issue has been patched in version 9.14.1.

Weakness: CWE-22 (Improper Limitation of a Pathname to a Restricted Directory)

## Which versions are affected by CVE-2026-34726?

3 open source packages ship an affected version, including copier. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `copier` | PyPI | All versions | 9.14.1 |
| `copier` | PyPI | All versions | 9.14.1 |
| `copier` | PyPI | All versions | 9.14.1 |

Products: Copier-Org Copier.

## How do I fix CVE-2026-34726?

Upgrade copier to 9.14.1 or later.

## Is CVE-2026-34726 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-34726 exists.

## Other vulnerabilities in copier-org copier

- [CVE-2026-23986](https://insights.sbomify.com/CVE-2026-23986/): Copier safe template has arbitrary filesystem write access via directory symlinks when _preserve_symlinks: true (medium 6.9)
- [CVE-2026-23968](https://insights.sbomify.com/CVE-2026-23968/): Copier safe template has arbitrary filesystem read access via symlinks when _preserve_symlinks: false (medium 6.8)
- [CVE-2026-34730](https://insights.sbomify.com/CVE-2026-34730/): Copier `_external_data` allows path traversal and absolute-path local file read without unsafe mode (medium 5.5)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-34726 and fix it if it is affected.

What it is: CVE-2026-34726 is a medium-severity path traversal vulnerability in copier-org copier, published on 2 Apr 2026. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2026-34726 exists.

Affected packages and fixed versions:
- copier (PyPI): affected all versions; fixed in 9.14.1
- copier (PyPI): affected all versions; fixed in 9.14.1
- copier (PyPI): affected all versions; fixed in 9.14.1

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-34726/ (Markdown: https://insights.sbomify.com/CVE-2026-34726/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-34726
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-34726
- OSV: https://osv.dev/vulnerability/CVE-2026-34726

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-34726/
Summaries are generated and may contain mistakes; the official description above is the record.
