CVE-2021-29438: @nextcloud/dialogs Cross-Site Scripting Vulnerability
MODERATECVE-2021-29438 is a MODERATE (CVSS 4.6) cross-site scripting vulnerability (CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)) affecting @nextcloud/dialogs libraries in the npm ecosystem. The issue involves improper neutralization of script-related html tags in a web page (basic xss) in @nextcloud/dialogs. Remediation is available by upgrading affected packages to version 3.1.2.
CVE-2021-29438 at a Glance
Security Impact
CVSS: 4.6
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N).
How to Fix CVE-2021-29438
To remediate this vulnerability, upgrade all affected @nextcloud/dialogs 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 @nextcloud/dialogs@3.1.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls @nextcloud/dialogs
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-29438, inspect your project dependencies using npm:
npm ls @nextcloud/dialogs
Analyze the terminal output to locate any version of @nextcloud/dialogs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.1.2), your application is affected.
Note: The npm ls @nextcloud/dialogs 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-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes special characters such as "<", ">", and "&" that could be interpreted as web-scripting elements when they are sent to a downstream component that processes web pages. In @nextcloud/dialogs, 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-2021-29438 Affected @nextcloud/dialogs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
@nextcloud/dialogs
|
npm |
< 3.1.2
|
3.1.2
|
References
Frequently Asked Questions
What is CVE-2021-29438?
Which @nextcloud/dialogs versions are affected?
What version fixes CVE-2021-29438?
Is @nextcloud/dialogs affected?
What is the CVSS score of CVE-2021-29438?
What CWE is associated with CVE-2021-29438?
How can I check npm dependencies for CVE-2021-29438?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-g3fq-3v3g-mh32",
"modified" : "2021-04-13T18:40:52Z",
"published" : "2021-04-16T19:52:58Z",
"aliases" : [ "CVE-2021-29438" ],
"summary" : "Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) in @nextcloud/dialogs",
"details" : "### Impact\n\nThe Nextcloud dialogs library before 3.1.2 did insufficiently escape text input passed to a toast. If your application displays toasts with user-supplied input, this could lead to a XSS vulnerability.\n\n_Note_: Nextcloud Server employs a strict Content Security Policy that mitigates the risk of these XSS vulnerabilities.\n\n### Patches\n\nThe vulnerability has been patched in version 3.1.2. If you need to display HTML in the toast, explicitly pass the `options.isHTML` config flag.\n\n### Workarounds\n\nMake sure no user-supplied input flows into toasts.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "@nextcloud/dialogs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "3.1.2"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/nextcloud/nextcloud-dialogs/security/advisories/GHSA-g3fq-3v3g-mh32"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-29438"
}, {
"type" : "WEB",
"url" : "https://www.npmjs.com/package/@nextcloud/dialogs"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79", "CWE-80" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2021-04-13T18:40:52Z",
"nvd_published_at" : "2021-04-13T20:15:00Z"
}
}