CVE-2021-29438: XSS Vulnerability in @nextcloud/dialogs
Summary
CVE-2021-29438: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) in @nextcloud/dialogs. Affects @nextcloud/dialogs versions < 3.1.2. Fixed in 3.1.2. 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
The @nextcloud/dialogs library is an npm package used in Nextcloud applications to display dialogs and toasts. It provides a user-friendly interface for displaying messages and notifications. However, prior to version 3.1.2, the library did not properly escape text input passed to a toast, which could lead to a cross-site scripting (XSS) vulnerability. Nextcloud Server mitigates the risk of these XSS vulnerabilities through a strict Content Security Policy.
Vulnerability Detail
The XSS vulnerability in @nextcloud/dialogs arises from insufficiently escaped user-supplied input in the toast feature. If an application displays toasts with user-provided content, an attacker could inject malicious scripts into the toast, leading to the execution of arbitrary code in the context of the user's browser. This could result in various security risks, such as session hijacking, data theft, or unauthorized actions on behalf of the user. It is important to note that Nextcloud Server's Content Security Policy helps mitigate the impact of this vulnerability.
How To Fix
Latest published version: 7.5.0 as of 22 Oct 2026
npm install @nextcloud/dialogs@7.5.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.1.2
This is the first release that contains the fix.
npm install @nextcloud/dialogs@3.1.2
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
To mitigate the risk of this vulnerability until the library is updated, ensure that no user-supplied input is allowed to flow into the toasts displayed by the application. Sanitize and validate any user input before displaying it in the toast to prevent the execution of malicious scripts.
Conclusion
The XSS vulnerability in @nextcloud/dialogs can be mitigated by updating the library to version 3.1.2 or later. Additionally, it is important to ensure that user-supplied input is properly sanitized and validated before displaying it in toasts. Nextcloud Server's Content Security Policy provides additional protection against XSS vulnerabilities. For further assistance or support in vulnerability remediation, please contact DevNack.com.
See every vulnerability recorded for @nextcloud/dialogs →
FAQ
The vulnerability allows an attacker to inject malicious scripts into toasts, potentially leading to the execution of arbitrary code in the user's browser. This could result in various security risks, such as session hijacking, data theft, or unauthorized actions on behalf of the user.
To fix this vulnerability, update the @nextcloud/dialogs library to version 3.1.2 or later. Additionally, if HTML needs to be displayed in the toast, ensure that the options.isHTML config flag is explicitly passed.
Yes, Nextcloud Server employs a strict Content Security Policy that helps mitigate the risk of XSS vulnerabilities, including this one. However, it is still recommended to update the @nextcloud/dialogs library to the patched version.
A temporary workaround is to prevent any user-supplied input from flowing into the toasts displayed by the application. Sanitize and validate all user input before displaying it in the toast to prevent the execution of malicious scripts.
The vulnerability has been patched in version 3.1.2 of the @nextcloud/dialogs library. It is recommended to update to this version or later to fix the vulnerability.