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:
- A template defines
_external_data - Copier renders the configured path string
- Copier calls
load_answersfile_data(dst_path, rendered_path, warn_on_missing=True) load_answersfile_data()opensPath(dst_path, answers_file)directly- 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:
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 ../
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:
topsecret
PoC 2: _external_data reads an absolute path
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:
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
Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files. Typical impact: unauthorized file read or write outside the intended directory.
CVE-2026-34730 has a CVSS score of 5.5 (Medium). The vector is requires local access, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (9.14.1); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-34730? CVE-2026-34730 is a medium-severity path traversal vulnerability in copier (pip), affecting versions <= 9.14.0. It is fixed in 9.14.1. Input manipulates file paths to reach files outside the intended directory, such as configuration or credential files.
- How severe is CVE-2026-34730? CVE-2026-34730 has a CVSS score of 5.5 (Medium). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of copier are affected by CVE-2026-34730? copier (pip) versions <= 9.14.0 is affected.
- Is there a fix for CVE-2026-34730? Yes. CVE-2026-34730 is fixed in 9.14.1. Upgrade to this version or later.
- Is CVE-2026-34730 exploitable, and should I be worried? Whether CVE-2026-34730 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-34730 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-34730? Upgrade
copierto 9.14.1 or later.