CVE-2021-29438: @nextcloud/dialogs Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-g3fq-3v3g-mh32
CVSS 4.6
CWE-80 CWE-79
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2021-29438
GHSA Identifier GHSA-g3fq-3v3g-mh32
Severity MODERATE
CVSS v3.1 Base Score 4.6
CWE Classification CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS)
Affected Product @nextcloud/dialogs
Package Ecosystem npm
Published Date
Last Updated

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).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required Low (PR:L)
User Interaction Required (UI:R)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability None (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.

@nextcloud/dialogs fixed: 3.1.2
npm install @nextcloud/dialogs@3.1.2
Verify Direct and Transitive Dependencies

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

### Impact The 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. _Note_: Nextcloud Server employs a strict Content Security Policy that mitigates the risk of these XSS vulnerabilities. ### Patches The 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. ### Workarounds Make sure no user-supplied input flows into toasts.

CVE-2021-29438 Affected @nextcloud/dialogs Versions

1 component(s)
Fixed Versions:
3.1.2
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?
CVE-2021-29438 is a security vulnerability in @nextcloud/dialogs involving Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) in @nextcloud/dialogs under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS).
Which @nextcloud/dialogs versions are affected?
Affected versions include releases prior to 3.1.2 across affected packages: @nextcloud/dialogs.
What version fixes CVE-2021-29438?
Upgrading to 3.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @nextcloud/dialogs affected?
Yes, @nextcloud/dialogs is affected in releases prior to 3.1.2. Upgrade your dependency to 3.1.2 or later.
What is the CVSS score of CVE-2021-29438?
CVE-2021-29438 has a CVSS v3.1 base score of 4.6 (MODERATE) with vector string CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:L/I:L/A:N.
What CWE is associated with CVE-2021-29438?
CVE-2021-29438 is classified under CWE-80: Improper Neutralization of Script-Related HTML Tags in a Web Page (Basic XSS) (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.).
How can I check npm dependencies for CVE-2021-29438?
Run the dependency tree command: 'npm ls @nextcloud/dialogs'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}