Vulnerabilities in pkg:npm/docsify
PACKAGECVE-2021-30074 is a MODERATE (CVSS 6.1) cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Docsify libraries in the npm ecosystem. The issue involves docsify vulnerable to cross-site scripting due to mishandled encoding. Remediation is available by upgrading affected packages to version 4.12.2.
pkg:npm/docsify
Vulnerability advisories affecting package pkg:npm/docsify. Select an advisory below to view technical details or fixes.
| Advisory ID | CVE / NVD | Severity | Summary |
|---|---|---|---|
| GHSA-5h7x-68wj-jhwc | CVE-2021-30074 | MODERATE | Docsify vulnerable to cross-site scripting due to mishandled encoding |
| GHSA-2mm9-c2fx-c7m4 | CVE-2021-23342 | MODERATE | Docsify XSS Vulnerability |
| GHSA-qpqh-46qj-vwcw | CVE-2020-7680 | MODERATE | Cross-site Scripting in docsify |
CVE-2021-30074 at a Glance
Security Impact
CVSS: 6.1
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:L/I:L/A:N).
How to Fix CVE-2021-30074
To remediate this vulnerability, upgrade all affected Docsify 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 docsify@4.12.2
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
npm ls docsify
How to Check if You Are Affected
To determine whether your Node.js application is affected by CVE-2021-30074, inspect your project dependencies using npm:
npm ls docsify
Analyze the terminal output to locate any version of Docsify in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.12.2), your application is affected.
Note: The npm ls docsify 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 Docsify, 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-2021-30074 Affected Docsify Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
docsify
|
npm |
< 4.12.2
|
4.12.2
|
References
Frequently Asked Questions
What is CVE-2021-30074?
Which Docsify versions are affected?
What version fixes CVE-2021-30074?
Is docsify affected?
What is the CVSS score of CVE-2021-30074?
What CWE is associated with CVE-2021-30074?
How can I check npm dependencies for CVE-2021-30074?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-5h7x-68wj-jhwc",
"modified" : "2023-10-19T18:36:33Z",
"published" : "2022-05-24T17:46:27Z",
"aliases" : [ "CVE-2021-30074" ],
"summary" : "Docsify vulnerable to cross-site scripting due to mishandled encoding",
"details" : "docsify versions 4.12.1 and earlier are vulnerable to cross-site scripting (XSS) because the search component does not appropriately encode Code Blocks and mishandles the `\"` character.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "npm",
"name" : "docsify"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "4.12.2"
} ]
} ],
"database_specific" : {
"last_known_affected_version_range" : "<= 4.12.1"
}
} ],
"references" : [ {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2021-30074"
}, {
"type" : "WEB",
"url" : "https://github.com/docsifyjs/docsify/issues/1549"
}, {
"type" : "WEB",
"url" : "https://github.com/docsifyjs/docsify/pull/1551"
}, {
"type" : "WEB",
"url" : "https://github.com/docsifyjs/docsify/commit/c24f7f6f0b87a87f6dd3755f69eb0969ebb029c9"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/docsifyjs/docsify"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-79" ],
"severity" : "MODERATE",
"github_reviewed" : true,
"github_reviewed_at" : "2023-10-19T18:36:33Z",
"nvd_published_at" : "2021-04-02T21:15:00Z"
}
}