CVE-2022-0764: Command injection in strapi
Summary
CVE-2022-0764: Command injection in strapi. Affects strapi versions < 4.1.0. Fixed in 4.1.0. How to fix ↓
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.
No signup required · Results in about 60 seconds
Background
Strapi is an open-source headless CMS (Content Management System) that enables developers to build powerful APIs quickly. It provides a flexible and customizable admin panel for managing content. The vulnerability in question allows for command injection when creating a Strapi app using the npx create-strapi-app command. This vulnerability arises due to improper sanitization of user input in the template CLI argument.
Vulnerability Detail
The command injection vulnerability in Strapi allows an attacker to execute arbitrary commands during the creation of a Strapi app. By injecting malicious commands through the template CLI argument, an attacker can potentially gain unauthorized access, escalate privileges, or perform other malicious activities on the affected system. This vulnerability poses a moderate risk and has a CVSS score of 6.1.
How To Fix
Latest published version: 3.6.11 as of 22 Oct 2026
npm install strapi@3.6.11
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
4.1.0
This is the first release that contains the fix.
npm install strapi@4.1.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, users can manually sanitize the template CLI argument by ensuring that only valid and expected values are provided. This can be done by validating and sanitizing user input before passing it to the npx create-strapi-app command. Here is an example of how to sanitize the template CLI argument in Node.js:
const { exec } = require('child_process');
function sanitizeTemplate(template) {
// Validate and sanitize the template value
const sanitizedTemplate = template.replace(/[^a-zA-Z0-9-]/g, '');
return sanitizedTemplate;
}
const template = sanitizeTemplate(userInput);
exec(`npx create-strapi-app --template ${template}`, (error, stdout, stderr) => {
// Handle the command execution result
});
Conclusion
In conclusion, the command injection vulnerability in Strapi allows for the execution of arbitrary commands during the creation of a Strapi app. It is crucial to update the Strapi package to version 4.1.0 or later to mitigate this vulnerability. For further support on vulnerability remediation, contact DevNack.com.
See every vulnerability recorded for strapi →
FAQ
Strapi is an open-source headless CMS (Content Management System) that allows developers to build powerful APIs quickly. It provides a flexible and customizable admin panel for managing content.
The command injection vulnerability in Strapi occurs when creating a Strapi app using the npx create-strapi-app command. Improper sanitization of user input in the template CLI argument allows for the injection of arbitrary commands.
This vulnerability can allow an attacker to execute arbitrary commands during the creation of a Strapi app. They may gain unauthorized access, escalate privileges, or perform other malicious activities on the affected system.
The severity of this vulnerability is considered moderate, with a CVSS score of 6.1.
To fix this vulnerability, update the Strapi package to version 4.1.0 or later. Run the command npm install strapi@4.1.0 to update your Strapi installation.
References
Related vulnerabilities
Recent vulnerabilities recorded for strapi.