CVE-2021-23342: XSS in docsify
Summary
CVE-2021-23342: Docsify XSS Vulnerability. Affects docsify versions < 4.12.0. Fixed in 4.12.0. How to fix ↓
Check if this vulnerability affects your application
Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.
No signup required · Results in about 60 seconds
Background
The package under scrutiny is docsify, an npm package used for generating documentation websites. It allows users to write documentation in Markdown format and automatically converts it into a website. The package is widely used for creating documentation for various projects. However, it is vulnerable to a cross-site scripting (XSS) attack.
Vulnerability Detail
The vulnerability in docsify (before version 4.12.0) allows an attacker to bypass the remediation done by CVE-2020-7680 and execute malicious JavaScript. There are two methods to exploit this vulnerability:
-
When parsing HTML from remote URLs, the HTML code on the main page is sanitized, but this sanitization is not taking place in the sidebar. This allows an attacker to inject malicious code through the sidebar.
-
The isURL external check can be bypassed by inserting more "////" characters. This allows an attacker to bypass the URL validation and execute arbitrary JavaScript code.
How To Fix
Minimum fixed version
4.12.0
This is the first release that contains the fix.
npm install docsify@4.12.0
Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →
Workaround
There is no known workaround for this vulnerability. It is crucial to update the package to the latest version to mitigate the risk of XSS attacks.
Conclusion
The vulnerability in docsify allows an attacker to execute malicious JavaScript code on the affected website. To mitigate this risk, it is crucial to update the package to version 4.12.0 or later. For further support on vulnerability remediation, you can contact DevNack.com.
See every vulnerability recorded for docsify →
FAQ
This vulnerability allows an attacker to execute malicious JavaScript code on the affected website, potentially leading to unauthorized access, data theft, or other malicious activities.
There are no known public exploits available for this vulnerability at the moment. However, it is important to update the package to the latest version to prevent any potential attacks.
Yes, this vulnerability can be exploited remotely. An attacker can inject malicious code through the sidebar or bypass URL validation to execute arbitrary JavaScript code.
No specific conditions are required to exploit this vulnerability. An attacker can exploit it by injecting malicious code through the sidebar or bypassing URL validation.
Yes, this vulnerability has been fixed in version 4.12.0 of the docsify package. It is recommended to update to this version or later to mitigate the risk.
Related vulnerabilities
Recent vulnerabilities recorded for docsify.