CVE-2021-25978: Cross-site Scripting in apostrophe
Summary
CVE-2021-25978: Cross-site Scripting in apostrophe. Affects apostrophe versions >= 2.63.0, < 3.4.0. Fixed in 3.4.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
Apostrophe CMS is an open-source content management system built on Node.js and MongoDB. It provides a flexible and user-friendly interface for managing website content. The vulnerability affects versions 2.63.0 to 3.3.1 of the apostrophe package. Apostrophe allows editors to upload SVG files to the Images module, which can be used to display images on the website. However, due to a lack of proper input sanitization, an attacker can upload an SVG file containing malicious JavaScript code. When viewed, this code is executed in the context of the user's browser, leading to a stored cross-site scripting (XSS) vulnerability.
Vulnerability Detail
The stored XSS vulnerability in apostrophe CMS allows an attacker to upload a specially crafted SVG file containing malicious JavaScript code. When the file is viewed by a user, the code is executed in the user's browser, potentially allowing the attacker to perform actions on behalf of the user, steal sensitive information, or manipulate the website's content. The vulnerability has a CVSS score of 5.4, indicating a moderate severity level.
How To Fix
Latest published version: 4.34.0 as of 23 Oct 2026
npm install apostrophe@4.34.0
Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.
If you need the minimum change
3.4.0
This is the first release that contains the fix.
npm install apostrophe@3.4.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
As a temporary workaround, you can disable the upload functionality for SVG files in the Images module. This can be done by modifying the code responsible for handling file uploads and adding a validation check to disallow SVG files. Here is an example of how the code can be modified:
// Add the following check before processing the uploaded file
if (file.type === 'image/svg+xml') {
throw new Error('SVG file uploads are currently disabled.');
}
Conclusion
The stored XSS vulnerability in apostrophe CMS versions 2.63.0 to 3.3.1 can allow an attacker to execute malicious JavaScript code in the context of a user's browser. To mitigate this issue, it is recommended to upgrade to version 3.4.0 or later of the apostrophe package. Additionally, a temporary workaround is available by disabling SVG file uploads in the Images module. For further support and assistance, please contact DevNack.com.
See every vulnerability recorded for apostrophe →
FAQ
The vulnerability allows an attacker to execute arbitrary JavaScript code in the context of a user's browser, potentially leading to unauthorized actions, data theft, or content manipulation.
No, only versions between 2.63.0 and 3.3.1 are vulnerable. It is recommended to upgrade to version 3.4.0 or later to mitigate the issue.
Yes, you can temporarily disable SVG file uploads in the Images module to mitigate the vulnerability. However, it is still recommended to upgrade to the latest version for a permanent fix.
You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply provide your package-lock.json file and Vulert will analyze it for vulnerabilities in real-time.
For further support and assistance in remediating this vulnerability, you can reach out to info@devnack.com. Our team of experts will be happy to assist you.
References
Related vulnerabilities
Recent vulnerabilities recorded for apostrophe.