CVE-2021-23342

8.6 HIGH

📋 TL;DR

This is a cross-site scripting (XSS) vulnerability in docsify documentation generators before version 4.12.0. Attackers can bypass previous security fixes to inject malicious JavaScript through sidebar content or URL parsing, potentially compromising user sessions. Anyone using vulnerable docsify versions for documentation websites is affected.

💻 Affected Systems

Products:
  • docsify
Versions: All versions before 4.12.0
Operating Systems: All
Default Config Vulnerable: ⚠️ Yes
Notes: Affects docsify when used with remote URL content loading or sidebar functionality enabled.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete account takeover, session hijacking, credential theft, and malware distribution to all website visitors through persistent XSS payloads.

🟠

Likely Case

Session hijacking, credential theft, and defacement of documentation sites through injected malicious scripts.

🟢

If Mitigated

Limited impact with proper content security policies and input validation, but still potential for limited script execution.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Public exploit details available in security advisories with specific bypass techniques documented.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 4.12.0 and later

Vendor Advisory: https://github.com/docsifyjs/docsify/commit/ff2a66f12752471277fe81a64ad6c4b2c08111fe

Restart Required: No

Instructions:

1. Update docsify to version 4.12.0 or later using npm: npm update docsify 2. Verify the update completed successfully 3. Test documentation functionality

🔧 Temporary Workarounds

Disable remote URL loading

all

Prevent docsify from loading content from remote URLs to block the primary attack vector

Configure docsify to only load local content files

Implement Content Security Policy

all

Add strict CSP headers to limit script execution sources

Add Content-Security-Policy header with script-src 'self'

🧯 If You Can't Patch

  • Implement web application firewall rules to detect and block XSS payloads in URLs and sidebar content
  • Disable sidebar functionality if not essential for documentation needs

🔍 How to Verify

Check if Vulnerable:

Check docsify version in package.json or via npm list docsify

Check Version:

npm list docsify | grep docsify

Verify Fix Applied:

Confirm version is 4.12.0 or higher and test that remote URL content is properly sanitized

📡 Detection & Monitoring

Log Indicators:

  • Unusual URL patterns with multiple slashes (////)
  • JavaScript execution errors in sidebar context
  • Unexpected remote content loading

Network Indicators:

  • HTTP requests with malicious script patterns in query parameters
  • Unusual content loading from external sources

SIEM Query:

web_logs WHERE url CONTAINS '////' OR url CONTAINS '<script' OR user_agent CONTAINS 'docsify'

🔗 References

📤 Share & Export