Copier safe template has arbitrary filesystem read access via symlinks when _preserve_symlinks: false

Description

Impact

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 include arbitrary files/directories outside the local template clone location by using symlinks along with _preserve_symlinks: false (which is Copier's default setting).

Imagine, e.g., a malicious template author who creates a template that reads SSH keys or other secrets from well-known locations and hopes for a user to push the generated project to a public location like github.com where the template author can extract the secrets.

Reproducible example:

  • Illegally include a file in the generated project via symlink resolution:

    ```shell
    echo "s3cr3t" > secret.txt

    mkdir src/
    pushd src/
    ln -s ../secret.txt stolen-secret.txt
    popd

    uvx copier copy src/ dst/

    cat dst/stolen-secret.txt

    s3cr3t

    ```

  • Illegally include a directory in the generated project via symlink resolution:

    ```shell
    mkdir secrets/
    pushd secrets/
    echo "s3cr3t" > secret.txt
    popd

    mkdir src/
    pushd src/
    ln -s ../secrets stolen-secrets
    popd

    uvx copier copy src/ dst/

    tree dst/

    dst/

    └── stolen-secrets

    └── secret.txt

    1 directory, 1 file

    cat dst/stolen-secrets/secret.txt

    s3cr3t

    ```

Patches

n/a

Workarounds

n/a

References

n/a

Basic information

Type
reviewed
Severity
medium
Advisory on GitHub
Open advisory ↗
Repository advisory
Open repository advisory ↗
Source code
Browse source ↗
Published (advisory)
2026-01-21 22:08:48 UTC
Updated
2026-02-02 16:33:41 UTC
GitHub reviewed
2026-01-21 22:08:48 UTC
NVD published
2026-01-21

EPSS Score

Score Percentile
0.04% 12.22%

CVSS Scores

Base score Version Severity Vector
5.5 3.1
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N Click to expand
Attack vector (AV:L)
They already need access on the box, or another person has to do something wrong; it’s not a remote drive-by.
Attack complexity (AC:L)
Once they can reach the bug, pulling it off is straightforward—no weird race conditions or rare setup.
Privileges required (PR:N)
No account or special rights needed—anonymous or random user is enough.
User interaction (UI:R)
A real person has to do something—click, install, enable—otherwise it doesn’t land.
Scope (S:U)
Damage stays in the same “trust bubble” as the broken component—no big spill into unrelated systems.
Confidentiality (C:H)
Serious risk that confidential data gets exposed in a big way.
Integrity (I:N)
Data isn’t meaningfully altered or forged.
Availability (A:N)
Service keeps running; no real outage angle.
6.8 4.0
CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:P/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N Click to expand
Attack vector (AV:L)
Attacker needs local access on the target system.
Attack complexity (AC:L)
Exploitation conditions are straightforward and stable.
Attack requirements (AT:N)
No additional preconditions are required beyond normal reachability.
Privileges required (PR:N)
No privileges are required.
User interaction (UI:P)
A user has to participate (for example click/open/approve).
Vulnerable system confidentiality impact (VC:H)
High confidentiality impact on the vulnerable system.
Vulnerable system integrity impact (VI:N)
No integrity impact on the vulnerable system.
Vulnerable system availability impact (VA:N)
No availability impact on the vulnerable system.
Subsequent system confidentiality impact (SC:N)
No confidentiality impact on subsequent systems.
Subsequent system integrity impact (SI:N)
No integrity impact on subsequent systems.
Subsequent system availability impact (SA:N)
No availability impact on subsequent systems.

Identifiers

CWEs

CWE id Name
CWE-61 UNIX Symbolic Link (Symlink) Following

Credits

  • sisp (remediation_developer)
  • cbrown1234 (remediation_reviewer)

Affected packages (1)

Vulnerable version ranges and first patched releases as published by GitHub.

Ecosystem Package Vulnerable range First patched Vulnerable functions
pip copier < 9.11.2 9.11.2

References

cvelogic Threat Intelligence