CVE-2026-23986

Copy-Paste-Pwn: Escaping the Sandbox in Copier via Symlink Teleportation

Alon Barad
Alon Barad
Software Engineer

Jan 22, 2026·6 min read·3 visits

Executive Summary (TL;DR)

If you use Copier to generate projects from templates, a malicious template author can overwrite your files (like SSH keys or config files) even without the `--UNSAFE` flag. The vulnerability exploits the order in which Copier processes files: if it creates a symlink to `/etc` first, and then writes a file 'inside' that symlink, the write escapes the sandbox.

A logic flaw in Copier's symlink handling allows 'safe' templates to escape the destination directory and overwrite arbitrary files on the host system. By abusing the '_preserve_symlinks' feature and the non-deterministic nature of directory iteration, attackers can trick the renderer into writing through a symlink before checking where it points.

Fix Analysis (2)

Technical Appendix

CVSS Score
6.9/ 10
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 Systems

Copier CLI < 9.11.2Copier Python Library < 9.11.2

Affected Versions Detail

Product
Affected Versions
Fixed Version
copier
copier-org
< 9.11.29.11.2
AttributeDetail
CWE IDCWE-61 (Symlink Following)
CVSS 4.06.9 (Medium)
Attack VectorLocal (via Template)
Privileges RequiredNone
User InteractionRequired (User must run copier)
ImpactHigh Integrity / High Availability
CWE-61
UNIX Symbolic Link (Symlink) Following

The product uses a search path or similar mechanism to resolve a reference to a resource, but it does not properly prevent the path from resolving to a resource that is outside of the intended control sphere via symbolic links.

Vulnerability Timeline

Vulnerability discovered
2026-01-08
Fixes committed to repository
2026-01-13
Copier v9.11.2 released
2026-01-20
CVE-2026-23986 and GHSA published
2026-01-21

Subscribe to updates

Get the latest CVE analysis reports delivered to your inbox.