Vulnerabilities in pkg:npm/@strapi/plugin-email
PACKAGECVE-2023-22621 is a CRITICAL (CVSS 10.0) remote code execution vulnerability (CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')) affecting @strapi/plugin users permissions libraries in the npm ecosystem. The issue involves strapi plugins vulnerable to server-side template injection and remote code execution in the users-permissions plugin. Remediation is available by upgrading affected packages to version 4.5.6.
pkg:npm/@strapi/plugin-email
Vulnerability advisories affecting package pkg:npm/@strapi/plugin-email. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-2h87-4q2w-v4hf | CVE-2023-22621 | CRITICAL | Strapi plugins vulnerable to Server-Side Template Injection and Remote Code Execution in the Users-Permissions Plugin |
CVE-2023-22621 at a Glance
Security Impact
CVSS: 10.0
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H).
How to Fix CVE-2023-22621
To remediate this vulnerability, upgrade all affected @strapi/plugin users permissions dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
npm install @strapi/plugin-users-permissions@4.5.6
npm install @strapi/plugin-email@4.5.6
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @strapi/plugin-users-permissions
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2023-22621, inspect your project dependencies using npm:
npm ls @strapi/plugin-users-permissions
Analyze the terminal output to locate any version of @strapi/plugin users permissions in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.5.6), your application is affected.
Note: The npm ls @strapi/plugin-users-permissions command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection'), where the product constructs all or part of a command, data structure, or record using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify how it is parsed or interpreted when it is sent to a downstream component. In @strapi/plugin users permissions, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2023-22621 Affected @strapi/plugin users permissions Versions
2 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@strapi/plugin-users-permissions
|
npm |
< 4.5.6
|
4.5.6
|
|
@strapi/plugin-email
|
npm |
< 4.5.6
|
4.5.6
|
References
Frequently Asked Questions
What is CVE-2023-22621?
Which @strapi/plugin users permissions versions are affected?
What version fixes CVE-2023-22621?
Is @strapi/plugin-users-permissions affected?
Is @strapi/plugin-email affected?
What is the CVSS score of CVE-2023-22621?
What CWE is associated with CVE-2023-22621?
How can I check npm dependencies for CVE-2023-22621?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-2h87-4q2w-v4hf",
"modified" : "2023-05-01T18:34:55Z",
"published" : "2023-04-19T21:41:30Z",
"aliases" : [ "CVE-2023-22621" ],
"summary" : "Strapi plugins vulnerable to Server-Side Template Injection and Remote Code Execution in the Users-Permissions Plugin",
"details" : "### Summary\n\nStrapi through 4.5.5 allows authenticated Server-Side Template Injection (SSTI) that can be exploited to execute arbitrary code on the server.\n\n### Details\n\nStrapi through 4.5.5 allows authenticated Server-Side Template Injection (SSTI) that can be exploited to execute arbitrary code on the server. A remote attacker with access to the Strapi admin panel can inject a crafted payload that executes code on the server into an email template that bypasses the validation checks that should prevent code execution.\n\n### IoC\n\nUsing just the request log files, the only IoC to search for is a `PUT` request to URL path `/users-permissions/email-templates`. This IoC only indicates that a Strapi email template was modified on your server and by itself does not indicate if your Strapi server has been compromised. If this IoC is detected, you will need to manually review your email templates on your Strapi server and backups of your database to see if any of the templates contain a `lodash` template delimiter (eg. `<%STUFF HERE%>`) that contains suspicious JavaScript code. Generally speaking these templates should look like the following, you may have minor adjustments but any unrecognized code should be considered suspicious.\n\nReset Password Template:\n\n```html\n<p>We heard that you lost your password. Sorry about that!</p>\n\n<p>But don’t worry! You can use the following link to reset your password:</p>\n<p><%= URL %>?code=<%= TOKEN %></p>\n\n<p>Thanks.</p>\n```\n\nEmail Confirmation Template:\n\n```html\n<p>Thank you for registering!</p>\n\n<p>You have to confirm your email address. Please click on the link below.</p>\n\n<p><%= URL %>?confirmation=<%= CODE %></p>\n\n<p>Thanks.</p>\n```\n\nSpecifically you should look for odd code contained within the `<%STUFF HERE%>` blocks as this is what is used to bypass the lodash templating system. If you find any code that is not a variable name, or a variable name that is not defined in the template you are most likely impacted and should take immediate steps to confirm there are no malicious applications running on your servers.\n\n### Impact\n\nAll users on Strapi below 4.5.6 with access to the admin panel and the ability to modify the email templates\n",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@strapi/plugin-users-permissions"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.5.6"
} ]
} ]
}, {
"package" : {
"ecosystem" : "npm",
"name" : "@strapi/plugin-email"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.5.6"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/strapi/strapi/security/advisories/GHSA-2h87-4q2w-v4hf"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2023-22621"
}, {
"type" : "WEB",
"url" : "https://github.com/strapi/strapi/pull/15385"
}, {
"type" : "WEB",
"url" : "https://github.com/strapi/strapi/commit/921d30961d6ba96cc098f2aea197350a49f990bd"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/strapi/strapi"
}, {
"type" : "WEB",
"url" : "https://github.com/strapi/strapi/releases"
}, {
"type" : "WEB",
"url" : "https://github.com/strapi/strapi/releases/tag/v4.5.6"
}, {
"type" : "WEB",
"url" : "https://strapi.io/blog/security-disclosure-of-vulnerabilities-cve"
}, {
"type" : "WEB",
"url" : "https://www.ghostccamm.com/blog/multi_strapi_vulns"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-74" ],
"severity" : "CRITICAL",
"github_reviewed" : true,
"github_reviewed_at" : "2023-04-19T21:41:30Z",
"nvd_published_at" : "2023-04-19T16:15:07Z"
}
}