CVE-2026-23986 Copier safe template has arbitrary filesystem write access via directory symlinks when _preserve_symlinks: true

Medium 6.9 Published Updated

A malicious template can overwrite arbitrary files outside the destination directory via symlink traversal when symlink preservation is enabled.

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

What is CVE-2026-23986?

CVE-2026-23986 is a medium-severity path traversal vulnerability in copier-org copier, published on 21 Jan 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.11.2, Copier suggests that it's safe to generate a project from a safe template, i.e. one that doesn't use unsafe features like custom Jinja extensions which would require passing the `--UNSAFE,--trust` flag. As it turns out, a safe template can currently write to arbitrary directories outside the destination path by using directory a symlink along with `_preserve_symlinks: true` and a generated directory structure whose rendered path is inside the symlinked directory. 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. Version 9.11.2 patches the issue.

Weakness: CWE-61

Which versions are affected by CVE-2026-23986?

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

PackageAffectedFixed in
copier PyPIAll versions9.11.2
copier PyPIAll versions9.11.2
copier PyPIAll versions9.11.2

Products include Copier-Org Copier.

How do I fix CVE-2026-23986?

Upgrade copier to 9.11.2 or later.

Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.

Is CVE-2026-23986 being exploited?

There is no known exploitation of CVE-2026-23986 in the wild and no public exploit code.

Sources

Also known as GHSA-4fqp-r85r-hxqh, PYSEC-2026-1272.

Is CVE-2026-23986 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free