Executive Summary

A vulnerability in Copier, a tool for templating and project scaffolding, has been discovered. The vulnerability, tracked as CVE-2026-53951, allows an attacker to bypass the trust prefix check via path traversal, potentially leading to arbitrary command execution. This affects Copier versions from 9.5.0 to 9.15.1.

Technical Analysis

The vulnerability is caused by a flawed trust prefix comparison in `copier/_settings.py`. The `trust` setting's prefix match compares the template URL against a trusted prefix using a raw `str.startswith` without path normalization. However, the URL is normalized when the template is actually fetched. An attacker can exploit this by providing a template reference that textually starts with a trusted prefix but contains `..`, allowing the execution of arbitrary commands without prompting the user.

How It Gets Exploited

An attacker can exploit this vulnerability by providing a malicious template URL that appears to start with a trusted prefix but actually points to an attacker-controlled template. For example, an attacker could use a URL like `https://github.com/trusted-org/../attacker-org/repo.git`, which would be granted trust and allow the execution of arbitrary commands. The attacker can influence the template URL by providing a project with a manipulated `.copier-answers.yml` file, which is used by `copier update`.

Impact Assessment

The impact of this vulnerability is high, with a CVSS score of 8.8. An attacker can achieve arbitrary command execution, potentially leading to a complete compromise of the system. The vulnerability affects users of Copier versions 9.5.0 to 9.15.1.

Recommended Actions

To mitigate this vulnerability, users should update Copier to version 9.15.2 or later. Additionally, users should be cautious when using `copier update` with projects from untrusted sources, as an attacker can manipulate the template URL to exploit this vulnerability.

Sources

- GitHub Security Advisories - CVE-2026-53951