CVE-2022-24065: Command Injection in cookiecutter Package

cookiecutter Updated 02 Oct 2025

Summary

08/06/2022
Yes i
Critical
8.1

CVE-2022-24065: The package cookiecutter before 2.1.1 are vulnerable to Command Injection via hg argument injection. Affects cookiecutter across 2 version ranges.

< 2.1.1 < fdffddb31fd2b46344dfa317531ff155e7999f77

Fixed in fdffddb31fd2b46344dfa317531ff155e7999f77. How to fix ↓

Also tracked for

The same CVE-2022-24065 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored Devnack Mobile apps built by Devnack Design, build and launch iOS and Android apps with a senior product team. From idea to store release Start a project

Background

The cookiecutter package is a popular tool used in Python development for creating project templates. It allows developers to generate project structures based on predefined templates. The package provides a command-line interface and a Python API for creating projects. However, versions before 2.1.1 are vulnerable to command injection via the 'hg' argument injection. This vulnerability arises when the 'checkout' parameter is passed to the 'hg checkout' command, allowing additional flags to be set and potentially leading to command injection.

Vulnerability Detail

The command injection vulnerability in the cookiecutter package allows an attacker to execute arbitrary commands on the host system by manipulating the 'checkout' parameter. By injecting malicious commands, an attacker can perform unauthorized actions, such as executing arbitrary code, modifying files, or accessing sensitive information. This vulnerability poses a significant risk to systems using affected versions of the cookiecutter package.

How To Fix

Minimum fixed version

fdffddb31fd2b46344dfa317531ff155e7999f77

This is the first release that contains the fix.

pip install --upgrade "cookiecutter==fdffddb31fd2b46344dfa317531ff155e7999f77"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If upgrading to the latest version is not immediately feasible, users can mitigate the risk by avoiding the use of the 'checkout' parameter or by carefully validating and sanitizing user input before passing it to the 'checkout' parameter. It is crucial to ensure that the input does not contain any malicious commands or characters that could be interpreted as commands.

Conclusion

The command injection vulnerability in the cookiecutter package (CVE-2022-24065) allows attackers to execute arbitrary commands on the host system. To mitigate the risk, it is crucial to upgrade to version 2.1.1 or later of the package. Alternatively, users can follow the provided workarounds and ensure proper input validation. For further assistance and support in vulnerability remediation, please contact DevNack.com.

See every vulnerability recorded for cookiecutter →

Share this vulnerability

FAQ

This vulnerability allows an attacker to execute arbitrary commands on the host system, potentially leading to unauthorized actions, data breaches, or system compromise.

You can use Vulert's playground at Vulert Scanner to check if your application is affected by this vulnerability. Vulert analyzes your Pipfile.lock file and provides real-time alerts for open-source vulnerabilities.

At the time of this report, there are no known public exploits specifically targeting this vulnerability. However, it is essential to address the vulnerability promptly to prevent potential exploitation.

Yes, the vulnerability has been fixed in version 2.1.1 of the cookiecutter package. It is recommended to upgrade to this version or later to mitigate the risk.

Yes, if upgrading to the latest version is not feasible at the moment, you can mitigate the risk by avoiding the use of the 'checkout' parameter or by carefully validating and sanitizing user input before passing it to the 'checkout' parameter.

Related vulnerabilities

Recent vulnerabilities recorded for cookiecutter.

How To Fix

Minimum fixed version

fdffddb31fd2b46344dfa317531ff155e7999f77

This is the first release that contains the fix.

pip install --upgrade "cookiecutter==fdffddb31fd2b46344dfa317531ff155e7999f77"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback