Vulnerabilities in pkg:npm/diagram-js

PACKAGE
Advisory Summary

GHSA-8fw4-xh83-3j6q is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Diagram js libraries in the npm ecosystem. The issue involves cross-site scripting in diagram-js. Remediation is available by upgrading affected packages to version 2.6.2, 3.3.1.

1 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:npm/diagram-js

1 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:npm/diagram-js. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-8fw4-xh83-3j6q - MODERATE Cross-Site Scripting in diagram-js

GHSA-8fw4-xh83-3j6q at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-8fw4-xh83-3j6q
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Diagram js
Package Ecosystem npm
Published Date
Last Updated

How to Fix GHSA-8fw4-xh83-3j6q

To remediate this vulnerability, upgrade all affected Diagram js dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

diagram-js fixed: 2.6.2
npm install diagram-js@2.6.2
diagram-js fixed: 3.3.1
npm install diagram-js@3.3.1
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 diagram-js

How to Check if You Are Affected

To determine whether your Node.js application is affected by GHSA-8fw4-xh83-3j6q, inspect your project dependencies using npm:

npm ls diagram-js

Analyze the terminal output to locate any version of Diagram js in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.6.2), your application is affected.

Note: The npm ls diagram-js 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-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Diagram js, 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

Versions of `diagram-js` prior to 3.3.1 (for 3.x) and 2.6.2 (for 2.x) are vulnerable to Cross-Site Scripting. The package fails to escape output of user-controlled input in `search-pad`, allowing attackers to execute arbitrary JavaScript. ## Recommendation If you are using diagram-js 3.x, upgrade to version 3.3.1. If you are using diagram-js 2.x, upgrade to version 2.6.2.

GHSA-8fw4-xh83-3j6q Affected Diagram js Versions

2 component(s)
Fixed Versions:
2.6.23.3.1
Product / Package Ecosystem Affected Versions Fixed Version
diagram-js
npm
< 2.6.2
2.6.2
diagram-js
npm
≥ 3.0.0
< 3.3.1
3.3.1

References

Frequently Asked Questions

What is GHSA-8fw4-xh83-3j6q?
GHSA-8fw4-xh83-3j6q is a security vulnerability in Diagram js involving Cross-Site Scripting in diagram-js under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Diagram js versions are affected?
Affected versions include releases prior to 2.6.2, 3.3.1 across affected packages: diagram-js.
What version fixes GHSA-8fw4-xh83-3j6q?
Upgrading to 2.6.2, 3.3.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is diagram-js affected?
Yes, diagram-js is affected in releases prior to 2.6.2, 3.3.1. Upgrade your dependency to 2.6.2, 3.3.1 or later.
What CWE is associated with GHSA-8fw4-xh83-3j6q?
GHSA-8fw4-xh83-3j6q is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check npm dependencies for GHSA-8fw4-xh83-3j6q?
Run the dependency tree command: 'npm ls diagram-js'. 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-8fw4-xh83-3j6q",
  "modified" : "2021-09-28T16:58:42Z",
  "published" : "2020-09-11T21:18:05Z",
  "aliases" : [ ],
  "summary" : "Cross-Site Scripting in diagram-js",
  "details" : "Versions of `diagram-js` prior to 3.3.1 (for 3.x) and 2.6.2 (for 2.x) are vulnerable to Cross-Site Scripting. The package fails to escape output of user-controlled input in `search-pad`, allowing attackers to execute arbitrary JavaScript.\n\n\n## Recommendation\n\nIf you are using diagram-js 3.x, upgrade to version 3.3.1.\nIf you are using diagram-js 2.x, upgrade to version 2.6.2.",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "diagram-js"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.6.2"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "diagram-js"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.3.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/bpmn-io/diagram-js/commit/2565c40449379284a55163f290ec812db34244d1"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/bpmn-io/diagram-js/commit/777fa06d70036daa9d02f3be6d0732cf4ccd8d6d"
  }, {
    "type" : "WEB",
    "url" : "https://bpmn.io/blog/posts/2019-html-injection-vulnerabilities-fixed.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/bpmn-io/diagram-js"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-08-31T18:42:58Z",
    "nvd_published_at" : null
  }
}