Command Injection Affecting cookiecutter package, versions [,2.1.1)


Severity

Recommended
0.0
high
0
10

CVSS assessment made by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of concept
EPSS
1.02% (85th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Command Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-COOKIECUTTER-2414281
  • published2 Jun 2022
  • disclosed2 Mar 2022
  • creditAlessio Della Libera of Snyk Research Team

Introduced: 2 Mar 2022

CVE-2022-24065  (opens in a new tab)
CWE-78  (opens in a new tab)
First added by Snyk

How to fix?

Upgrade cookiecutter to version 2.1.1 or higher.

Overview

cookiecutter is a command-line utility that creates projects from cookiecutters.

Affected versions of this package are vulnerable to Command Injection via hg argument injection. When calling the cookiecutter function from Python code with the checkout parameter, it is passed to the hg checkout command in a way that additional flags can be set. The additional flags can be used to perform a command injection.

PoC

from cookiecutter.main import cookiecutter

checkout = "--config=alias.checkout=!touch ./HELLO"
cookiecutter('some valid hg repository', checkout=checkout)

CVSS Scores

version 3.1