CVE-2020-7750: Scratch svg renderer Cross-Site Scripting Vulnerability

HIGH
Advisory Identifier: GHSA-j977-g5vj-j27g
CVSS 9.6
CWE-79
Published
Advisory Summary

CVE-2020-7750 is a HIGH (CVSS 9.6) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Scratch svg renderer libraries in the npm ecosystem. The issue involves cross-site scripting in scratch-svg-renderer. Remediation is available by upgrading affected packages to version 0.2.0-prerelease.20201019174008.

CVE-2020-7750 at a Glance

CVE Identifier CVE-2020-7750
GHSA Identifier GHSA-j977-g5vj-j27g
Severity HIGH
CVSS v3.1 Base Score 9.6
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Scratch svg renderer
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.6

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

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

How to Fix CVE-2020-7750

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

scratch-svg-renderer fixed: 0.2.0-prerelease.20201019174008
npm install scratch-svg-renderer@0.2.0-prerelease.20201019174008
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 scratch-svg-renderer

How to Check if You Are Affected

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

npm ls scratch-svg-renderer

Analyze the terminal output to locate any version of Scratch svg renderer in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.2.0-prerelease.20201019174008), your application is affected.

Note: The npm ls scratch-svg-renderer 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 Scratch svg renderer, 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

This affects the package scratch-svg-renderer before 0.2.0-prerelease.20201019174008. The loadString function does not escape SVG properly, which can be used to inject arbitrary elements into the DOM via the _transformMeasurements function.

CVE-2020-7750 Affected Scratch svg renderer Versions

1 component(s)
Fixed Versions:
0.2.0-prerelease.20201019174008
Product / Package Ecosystem Affected Versions Fixed Version
scratch-svg-renderer
npm
< 0.2.0-prerelease.20201019174008
0.2.0-prerelease.20201019174008

References

Frequently Asked Questions

What is CVE-2020-7750?
CVE-2020-7750 is a security vulnerability in Scratch svg renderer involving Cross-Site Scripting in scratch-svg-renderer under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Scratch svg renderer versions are affected?
Affected versions include releases prior to 0.2.0-prerelease.20201019174008 across affected packages: scratch-svg-renderer.
What version fixes CVE-2020-7750?
Upgrading to 0.2.0-prerelease.20201019174008 (or the latest patched release for your respective branch) resolves the vulnerability.
Is scratch-svg-renderer affected?
Yes, scratch-svg-renderer is affected in releases prior to 0.2.0-prerelease.20201019174008. Upgrade your dependency to 0.2.0-prerelease.20201019174008 or later.
What is the CVSS score of CVE-2020-7750?
CVE-2020-7750 has a CVSS v3.1 base score of 9.6 (HIGH) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H.
What CWE is associated with CVE-2020-7750?
CVE-2020-7750 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-2020-7750?
Run the dependency tree command: 'npm ls scratch-svg-renderer'. 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-j977-g5vj-j27g",
  "modified" : "2021-01-07T22:49:01Z",
  "published" : "2020-11-09T14:21:17Z",
  "aliases" : [ "CVE-2020-7750" ],
  "summary" : "Cross-Site Scripting in scratch-svg-renderer",
  "details" : "This affects the package scratch-svg-renderer before 0.2.0-prerelease.20201019174008. The loadString function does not escape SVG properly, which can be used to inject arbitrary elements into the DOM via the _transformMeasurements function.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "scratch-svg-renderer"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.2.0-prerelease.20201019174008"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.2.0-prerelease.20201016121710"
    }
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-7750"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/LLK/scratch-svg-renderer/commit/9ebf57588aa596c4fa3bb64209e10ade395aee90"
  }, {
    "type" : "WEB",
    "url" : "https://snyk.io/vuln/SNYK-JS-SCRATCHSVGRENDERER-1020497"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-11-09T14:09:20Z",
    "nvd_published_at" : null
  }
}