Skip to main content

Python CVE-2026-34730

MEDIUM
Path Traversal (CWE-22)
2026-04-01 https://github.com/copier-org/copier GHSA-hgjq-p8cr-gg4h
5.5
CVSS 3.1 · Vendor: https://github.com/copier-org/copier
View

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Impact

CVSS 5.5 with local attack vector (AV:L), low complexity (AC:L), no privilege requirement (PR:N), and user interaction (UI:R) indicates a moderate but real risk. The key exploitation signal is that path traversal works without the --UNSAFE flag, which users may reasonably assume provides security containment. CVSS rates this as High confidentiality impact (C:H) but no integrity or availability impact-accurate for a read-only disclosure vulnerability. However, real-world risk depends heavily on deployment context: if Copier is used only with trusted internal templates, risk is minimal; if developers routinely clone and run arbitrary templates from public repositories (e.g., GitHub), risk is significant. The public advisory and PoC availability (detailed in GitHub issue) indicate this is not a zero-day and the vendor acknowledges the issue. Exploitation requires user interaction (running copier copy), which is a natural operational pattern. This is a genuine security concern rather than a false-positive high-CVSS issue-it directly enables credential and secrets exfiltration.

Exploit ScenarioDerived

A developer downloads a Copier template from a public repository (e.g., GitHub) to scaffold a new project and runs copier copy template-dir new-project. The malicious template's copier.yml includes _external_data: {secret: ../../../home/user/.ssh/id_rsa}, and a Jinja2 template file renders this data. Copier loads the SSH private key, parses it as YAML (or raw text), and embeds it in a rendered output file within the new project. The attacker can then exfiltrate the file by committing it to a repository, uploading it to a logging service, or simply observing the rendered output. This attack requires no special privileges, no --UNSAFE flag, and only user interaction (running the copy command)-making it a practical threat in collaborative development environments.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Apr 01, 2026

Copier's _external_data feature allows malicious templates to read arbitrary files outside the destination directory via path traversal (e.g., ../secret.yml) or absolute paths (e.g., /tmp/secret.yml), exposing YAML-parsed contents in rendered output without requiring the --UNSAFE flag. This affects all versions of the Copier package and poses a risk when running untrusted templates, as attackers can disclose sensitive files accessible to the user running Copier.

RemediationAI

Apply the patched version of Copier released by the maintainers immediately; consult the GitHub advisory at https://github.com/copier-org/copier/security/advisories/GHSA-hgjq-p8cr-gg4h for the exact fixed version number and upgrade using pip install --upgrade copier. As an interim mitigation, restrict Copier usage to trusted templates only and avoid running copier copy against untrusted or downloaded template repositories. Code review of copier.yml files in templates to identify suspicious _external_data entries (e.g., those using ../ or absolute paths) can help identify compromised templates before execution. Organizations should consider implementing network- or host-level file access controls to limit Copier's ability to read sensitive files outside expected directories.

Affected Packages

pypi copier fix: 9.14.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Copier is a Python-based templating and scaffolding tool that processes YAML configuration files to manage project generation. The _external_data feature is designed to load external YAML files from paths relative to the destination directory, rendering them into templates via Jinja2. However, the implementation in copier/_user_data.py (function load_answersfile_data()) constructs file paths using Path(dst_path, answers_file) without path containment validation, allowing traversal via relative paths (../) or bypassing containment entirely with absolute paths. This violates CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and contrasts with Copier's explicit ForbiddenPathError checks applied elsewhere in the codebase for normal render-path traversal. The vulnerability leverages Python's pathlib.Path behavior, which resolves .. components during path construction, combined with yaml.safe_load() to parse and expose file contents.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/copier-org/copier) PRIMARY 5.5 MEDIUM
AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Primary rating from Vendor (https://github.com/copier-org/copier) · only source for this CVE.

CVSS VectorVendor: https://github.com/copier-org/copier

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

Lifecycle Timeline

2
Patch released
Apr 02, 2026 - 02:30 nvd
Patch available
CVE Published
Apr 01, 2026 - 22:38 nvd
MEDIUM 5.5

DescriptionCVE.org

Summary

Copier's _external_data feature allows a template to load YAML files using template-controlled paths. The documentation describes these values as relative paths from the subproject destination, so relative paths themselves appear to be part of the intended feature model.

However, the current implementation also allows destination-external reads, including:

  • Parent-directory paths such as ../secret.yml
  • Absolute paths such as /tmp/secret.yml

and then exposes the parsed contents in rendered output.

This is possible without --UNSAFE, which makes the behavior potentially dangerous when Copier is run against untrusted templates. I am not certain this is unintended behavior, but it is security-sensitive and appears important to clarify.

Details

The relevant flow is:

  1. A template defines _external_data
  2. Copier renders the configured path string
  3. Copier calls load_answersfile_data(dst_path, rendered_path, warn_on_missing=True)
  4. load_answersfile_data() opens Path(dst_path, answers_file) directly
  5. Parsed YAML becomes available as _external_data.<name> during rendering

Relevant code:

  • <https://github.com/copier-org/copier/blob/7aa7021bd73797c982492bac3535515d4484fdb7/copier/_main.py#L329-L332>
  • <https://github.com/copier-org/copier/blob/7aa7021bd73797c982492bac3535515d4484fdb7/copier/_user_data.py#L584-L592>

The sink is:

python
with Path(dst_path, answers_file).open("rb") as fd:
    return yaml.safe_load(fd)

There is no containment check to ensure the resulting path stays inside the subproject destination.

This is notable because Copier already blocks other destination-escape paths. Normal render-path traversal outside the destination is expected to raise ForbiddenPathError, and that behavior is explicitly covered by existing tests in <https://github.com/copier-org/copier/blob/7aa7021bd73797c982492bac3535515d4484fdb7/tests/test_copy.py#L1289-L1332>. _external_data does not apply an equivalent containment check.

The public documentation describes _external_data values as relative paths "from the subproject destination" in <https://github.com/copier-org/copier/blob/7aa7021bd73797c982492bac3535515d4484fdb7/docs/configuring.md#L944-L1005>, with examples using .copier-answers.yml and .secrets.yaml. That clearly supports relative-path usage, but it does not clearly communicate that a template may escape the destination with ../... or read arbitrary absolute paths. Because this behavior also works without --UNSAFE, it seems worth clarifying whether destination-external reads are intended, and if so, whether they should be documented as security-sensitive behavior.

PoC

PoC 1: _external_data reads outside the destination with ../
sh
mkdir src dst
echo 'token: topsecret' > secret.yml

printf '%s\n' '_external_data:' '  secret: ../secret.yml' > src/copier.yml
printf '%s\n' '{{ _external_data.secret.token }}' > src/leak.txt.jinja

copier copy --overwrite src dst
cat dst/leak.txt

Expected output:

text
topsecret
PoC 2: _external_data reads an absolute path
sh
mkdir abs-src abs-dst
echo 'token: abssecret' > absolute-secret.yml

printf '%s\n' '_external_data:' "  secret: $(pwd)/absolute-secret.yml" > abs-src/copier.yml
printf '%s\n' '{{ _external_data.secret.token }}' > abs-src/leak.txt.jinja

copier copy --overwrite abs-src abs-dst
cat abs-dst/leak.txt

Expected output:

text
abssecret

Impact

If untrusted templates are in scope, a malicious template can read attacker-chosen YAML-parseable local files that are accessible to the user running Copier and expose their contents in rendered output.

Practical impact:

  • Destination-external local file read
  • Disclosure of YAML/JSON/plain-text-like secrets if they parse successfully under yaml.safe_load
  • Possible without --UNSAFE

Threat Intelligence Overview

EPSS Score
0.0%
Top 99% exploitable
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High
NVD CVE.org EPSS Vulnrichment GHSA GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
Poc
System Exposure· derived
Small
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

28
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +28
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Affected Products (CPE)CVE.org

pkg:pip/copier

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy