CVE-2023-22621: Strapi Users-Permissions plugin RCE via Server-Side Template Injection

CVE-2023-22621 · Severity: low · CVSS 3.1 · Published 2023-04-19

Strapi, a popular open-source content management system, contains a vulnerability in its email template handling. An attacker with access to the administration panel can modify email templates to include malicious code. If successful, this allows the attacker to take full control of the server, potentially leading to data theft, service disruption, or further attacks on the internal network.

Technologies: @strapi/plugin-users-permissions (npm), Strapi Users & Permissions Plugin. Vendors: npm, Strapi.

Quick answers

Is CVE-2023-22621 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2023-22621 being exploited in the wild.
How severe is CVE-2023-22621?
Low severity, with a CVSS score of 3.1, published 19 April 2023.
Which products and versions are affected?
@strapi/plugin-email (npm) SEMVER:introduced=0,fixed=4.5.6; @strapi/plugin-users-permissions (npm) SEMVER:introduced=0,fixed=4.5.6; Strapi Email Plugin <= 4.5.5; Strapi Users & Permissions Plugin <= 4.5.5.
Is there a fix for CVE-2023-22621?
Yes. @strapi/plugin-email (npm): upgrade to 4.5.6 or later; @strapi/plugin-users-permissions (npm): upgrade to 4.5.6 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2023-22621 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2023-22621?
Check whether you run @strapi/plugin-email (npm), @strapi/plugin-users-permissions (npm), Strapi Email Plugin or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • @strapi/plugin-email (npm): upgrade to 4.5.6 or later
    npm install @strapi/plugin-email@4.5.6
  • @strapi/plugin-users-permissions (npm): upgrade to 4.5.6 or later
    npm install @strapi/plugin-users-permissions@4.5.6

Technical details

A Server-Side Template Injection (SSTI) vulnerability exists in Strapi through version 4.5.5 within the Users-Permissions and Email plugins. The root cause is improper validation of lodash template delimiters (e.g., <% %>) in email templates, which allows for the evaluation of arbitrary JavaScript. An authenticated attacker with permissions to modify email templates via the admin panel (specifically via PUT requests to /users-permissions/email-templates) can bypass existing validation checks to achieve Remote Code Execution (RCE). While some NVD assessments require high privileges, other sources indicate the impact is critical due to the potential for full system compromise. The issue is fixed in version 4.5.6 by implementing stricter interpolation and deactivating evaluation in the template utility.

Affected products

  • strapi strapi >= 3.0.0, < 4.5.6
  • strapi @strapi/plugin-users-permissions <= 4.5.5
  • strapi @strapi/plugin-email <= 4.5.5

Identifiers

  • CVE-2023-22621
  • GHSA-2h87-4q2w-v4hf

Timeline

  • 2023-01-10: patched: Fix merged into main branch
  • 2023-04-18: advisory: GitHub Security Advisory published
  • 2023-04-19: disclosed: NVD publication date

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.