Skip to content
XSS Write-up Intermediate

docsify <= 4.12.0 DOM-based Cross-Site Scripting Vulnerability

Docsify sanitises HTML from remote URLs on the main page but not in the sidebar, so an attacker who controls sidebar content can inject arbitrary HTML and run script in the victim's browser. This allows DOM-based cross-site scripting attacks.

karmainsecurity.com

Published on karmainsecurity.com

The vulnerability exists due to an incomplete fix for CVE-2020-7680. 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.

The author, on karmainsecurity.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the sanitisation added for CVE-2020-7680 was applied only to the main content rendering path and not to the sidebar rendering path, leaving the sidebar as an unsanitised HTML sink.

Impact

An attacker could inject arbitrary HTML into the sidebar and carry out DOM-based XSS against visitors of the documentation site.

What the attacker needed

Docsify 4.12.0 or earlier; sidebar content from a remote URL

The fix

It should be fixed by applying the same HTML sanitisation to sidebar content that is already applied to the main page, and the text says to upgrade to a later version.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

Docsify is a tool that turns markdown files into a documentation website. It cleans dangerous HTML on the main page but forgot to do the same for the sidebar menu, so a malicious sidebar file can carry hidden script that runs in a visitor's browser. That kind of script injection is called cross-site scripting, or XSS.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.