CVE-2022-31175: @ckeditor/ckeditor5 markdown gfm Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-42wq-rch8-6f6j
CVSS 5.8
CWE-79
Published
Advisory Summary

CVE-2022-31175 is a MODERATE (CVSS 5.8) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting @ckeditor/ckeditor5 markdown gfm libraries in the npm ecosystem. The issue involves ckeditor5 cross-site scripting vulnerability caused by the editor instance destroying process. Remediation is available by upgrading affected packages to version 35.0.1.

CVE-2022-31175 at a Glance

CVE Identifier CVE-2022-31175
GHSA Identifier GHSA-42wq-rch8-6f6j
Severity MODERATE
CVSS v3.1 Base Score 5.8
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product @ckeditor/ckeditor5 markdown gfm
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 5.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction Required (UI:R)
Scope Changed (S:C)
Confidentiality Low (C:L)
Integrity Low (I:L)
Availability Low (A:L)

How to Fix CVE-2022-31175

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

@ckeditor/ckeditor5-markdown-gfm fixed: 35.0.1
npm install @ckeditor/ckeditor5-markdown-gfm@35.0.1
@ckeditor/ckeditor5-html-support fixed: 35.0.1
npm install @ckeditor/ckeditor5-html-support@35.0.1
@ckeditor/ckeditor5-html-embed fixed: 35.0.1
npm install @ckeditor/ckeditor5-html-embed@35.0.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 @ckeditor/ckeditor5-markdown-gfm

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2022-31175, inspect your project dependencies using npm:

npm ls @ckeditor/ckeditor5-markdown-gfm

Analyze the terminal output to locate any version of @ckeditor/ckeditor5 markdown gfm in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 35.0.1), your application is affected.

Note: The npm ls @ckeditor/ckeditor5-markdown-gfm 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 @ckeditor/ckeditor5 markdown gfm, 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

### Affected packages @ckeditor/ckeditor5-markdown-gfm @ckeditor/ckeditor5-html-support @ckeditor/ckeditor5-html-embed ### Impact A cross-site scripting vulnerability has been discovered affecting three optional CKEditor 5's packages. The vulnerability allowed to trigger a JavaScript code after fulfilling special conditions: a) Using one of the affected packages. In case of `ckeditor5-html-support` and `ckeditor5-html-embed`, additionally, it was required to use a configuration that allows unsafe markup inside the editor, b) Initializing the editor on an element and using an element other than `<textarea>` as a base, c) Destroying the editor instance. The root cause of the issue was a mechanism responsible for updating the source element with the markup coming from the CKEditor 5 data pipeline after destroying the editor. This vulnerability might affect a small percent of integrators that depend on dynamic editor initialization/destroy and use [Markdown](https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html), [General HTML Support](https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support.html) or [HTML embed](https://ckeditor.com/docs/ckeditor5/latest/features/html-embed.html) features. ### Patches The problem has been recognized and patched. The fix will be available in version 35.0.1. ### For more information Email us at [security@cksource.com](mailto:security@cksource.com) if you have any questions or comments about this advisory.

CVE-2022-31175 Affected @ckeditor/ckeditor5 markdown gfm Versions

3 component(s)
Fixed Versions:
35.0.1
Product / Package Ecosystem Affected Versions Fixed Version
@ckeditor/ckeditor5-markdown-gfm
npm
< 35.0.1
35.0.1
@ckeditor/ckeditor5-html-support
npm
< 35.0.1
35.0.1
@ckeditor/ckeditor5-html-embed
npm
< 35.0.1
35.0.1

References

Frequently Asked Questions

What is CVE-2022-31175?
CVE-2022-31175 is a security vulnerability in @ckeditor/ckeditor5 markdown gfm involving CKEditor5 cross-site scripting vulnerability caused by the editor instance destroying process under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which @ckeditor/ckeditor5 markdown gfm versions are affected?
Affected versions include releases prior to 35.0.1 across affected packages: @ckeditor/ckeditor5-markdown-gfm, @ckeditor/ckeditor5-html-support, @ckeditor/ckeditor5-html-embed.
What version fixes CVE-2022-31175?
Upgrading to 35.0.1 (or the latest patched release for your respective branch) resolves the vulnerability.
Is @ckeditor/ckeditor5-markdown-gfm affected?
Yes, @ckeditor/ckeditor5-markdown-gfm is affected in releases prior to 35.0.1. Upgrade your dependency to 35.0.1 or later.
Is @ckeditor/ckeditor5-html-support affected?
Yes, @ckeditor/ckeditor5-html-support is affected in releases prior to 35.0.1. Upgrade your dependency to 35.0.1 or later.
What is the CVSS score of CVE-2022-31175?
CVE-2022-31175 has a CVSS v3.1 base score of 5.8 (MODERATE) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L.
What CWE is associated with CVE-2022-31175?
CVE-2022-31175 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 CVE-2022-31175?
Run the dependency tree command: 'npm ls @ckeditor/ckeditor5-markdown-gfm'. 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-42wq-rch8-6f6j",
  "modified" : "2022-08-11T18:08:35Z",
  "published" : "2022-08-06T09:40:43Z",
  "aliases" : [ "CVE-2022-31175" ],
  "summary" : "CKEditor5 cross-site scripting vulnerability caused by the editor instance destroying process",
  "details" : "### Affected packages\n@ckeditor/ckeditor5-markdown-gfm\n@ckeditor/ckeditor5-html-support\n@ckeditor/ckeditor5-html-embed\n\n### Impact\nA cross-site scripting vulnerability has been discovered affecting three optional CKEditor 5's packages. The vulnerability allowed to trigger a JavaScript code after fulfilling special conditions:\n\na) Using one of the affected packages. In case of `ckeditor5-html-support` and `ckeditor5-html-embed`, additionally, it was required to use a configuration that allows unsafe markup inside the editor,\nb) Initializing the editor on an element and using an element other than `<textarea>` as a base,\nc) Destroying the editor instance.\n\nThe root cause of the issue was a mechanism responsible for updating the source element with the markup coming from the CKEditor 5 data pipeline after destroying the editor. \n\nThis vulnerability might affect a small percent of integrators that depend on dynamic editor initialization/destroy and use [Markdown](https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html), [General HTML Support](https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support.html) or [HTML embed](https://ckeditor.com/docs/ckeditor5/latest/features/html-embed.html) features.\n\n### Patches\nThe problem has been recognized and patched. The fix will be available in version 35.0.1.\n\n### For more information\nEmail us at [security@cksource.com](mailto:security@cksource.com) if you have any questions or comments about this advisory.\n",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:L"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@ckeditor/ckeditor5-markdown-gfm"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "35.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@ckeditor/ckeditor5-html-support"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "35.0.1"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "@ckeditor/ckeditor5-html-embed"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "35.0.1"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/ckeditor/ckeditor5/security/advisories/GHSA-42wq-rch8-6f6j"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2022-31175"
  }, {
    "type" : "WEB",
    "url" : "https://ckeditor.com/docs/ckeditor5/latest/features/general-html-support.html"
  }, {
    "type" : "WEB",
    "url" : "https://ckeditor.com/docs/ckeditor5/latest/features/html-embed.html"
  }, {
    "type" : "WEB",
    "url" : "https://ckeditor.com/docs/ckeditor5/latest/features/markdown.html"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/ckeditor/ckeditor5"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2022-08-06T09:40:43Z",
    "nvd_published_at" : "2022-08-03T19:15:00Z"
  }
}