CVE-2020-15138: Prismjs Cross-Site Scripting Vulnerability
HIGHCVE-2020-15138 is a HIGH (CVSS 7.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Prismjs libraries in the npm ecosystem. The issue involves cross-site scripting in prism. Remediation is available by upgrading affected packages to version 1.21.0.
CVE-2020-15138 at a Glance
Security Impact
CVSS: 7.1
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:U/C:H/I:H/A:L).
How to Fix CVE-2020-15138
To remediate this vulnerability, upgrade all affected Prismjs 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 prismjs@1.21.0
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls prismjs
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2020-15138, inspect your project dependencies using npm:
npm ls prismjs
Analyze the terminal output to locate any version of Prismjs in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.21.0), your application is affected.
Note: The npm ls prismjs 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 Prismjs, 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-2020-15138 Affected Prismjs Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
prismjs
|
npm |
≥ 1.1.0
< 1.21.0
|
1.21.0
|
References
Frequently Asked Questions
What is CVE-2020-15138?
Which Prismjs versions are affected?
What version fixes CVE-2020-15138?
Is prismjs affected?
What is the CVSS score of CVE-2020-15138?
What CWE is associated with CVE-2020-15138?
How can I check npm dependencies for CVE-2020-15138?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-wvhm-4hhf-97x9",
"modified" : "2021-01-07T23:41:49Z",
"published" : "2020-08-07T22:28:30Z",
"aliases" : [ "CVE-2020-15138" ],
"summary" : "Cross-Site Scripting in Prism",
"details" : "### Impact\nThe easing preview of the Previewers plugin has an XSS vulnerability that allows attackers to execute arbitrary code in Safari and Internet Explorer.\n\nThis impacts all Safari and Internet Explorer users of Prism >=v1.1.0 that use the _Previewers_ plugin (>=v1.10.0) or the _Previewer: Easing_ plugin (v1.1.0 to v1.9.0).\n\n### Patches\nThis problem is patched in v1.21.0.\n\n### Workarounds\nTo workaround the issue without upgrading, [disable the easing preview](https://prismjs.com/plugins/previewers/#disabling-a-previewer) on all impacted code blocks. You need Prism v1.10.0 or newer to apply this workaround.\n\n### References\nThe vulnerability was introduced by this [commit](https://github.com/PrismJS/prism/commit/4303c940d3d3a20e8ce7635bf23331c75060f5c5) on Sep 29, 2015 and fixed by [Masato Kinugawa](https://twitter.com/kinugawamasato) (#2506).\n\n### For more information\nIf you have any questions or comments about this advisory, please [open an issue](https://github.com/PrismJS/prism/issues).",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:L"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "prismjs"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.1.0"
}, {
"fixed" : "1.21.0"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/PrismJS/prism/security/advisories/GHSA-wvhm-4hhf-97x9"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2020-15138"
}, {
"type" : "WEB",
"url" : "https://github.com/PrismJS/prism/pull/2506/commits/7bd7de05edf71112a3a77f87901a2409c9c5c20c"
}, {
"type" : "WEB",
"url" : "https://prismjs.com/plugins/previewers/#disabling-a-previewer"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2020-08-07T16:19:07Z",
"nvd_published_at" : null
}
}