/

CVE-2026-24045

Severity:

HIGH RISK

(7.3)

Cross-Site Scripting (XSS) in Docmost Public Share Pages

CVE-2026-24045

Modified

Vulnerability type

Category:

Cross-Site Scripting (XSS)

CWE:

CWE-79

Impact:

Client-Side Code Execution / Session Compromise

Severity:

HIGH RISK

(7.3)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Docmost's public share page feature fails to HTML-escape page titles before placing them into meta and title tags, enabling stored Cross-Site Scripting (XSS).

An attacker who can control a shared page's title may inject JavaScript that executes in the browser of any user who opens the shared link.

Affected context

This vulnerability affects Docmost instances where users can create or edit pages that are then shared via public links.

The issue occurs when user-controlled page titles are inserted into HTML meta tags and the <title> element without proper HTML escaping or output encoding.

Any environment that exposes these public share URLs to other users, including external collaborators or anonymous visitors, may be at risk if attackers can influence page titles.

Exploit preconditions

  • Attack surface: Web browser rendering Docmost public share pages
  • Required access: Ability to create or modify a Docmost page that can be shared publicly (e.g., authenticated user with page edit rights)
  • Trigger point: A victim opening a crafted public share URL in their browser
  • Why exploitation is possible: The page's title, controlled by the attacker, is written directly into meta and title tags without HTML escaping or context-appropriate output encoding, allowing injected script to execute.

Why this happens

The root cause is improper output encoding of user-supplied data in an HTML context, mapped to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-Site Scripting).

The application takes a page title, which may contain markup or script, and embeds it directly into meta tags and the <title> element in the document head.

Without applying HTML-escaping or a templating mechanism that enforces context-aware escaping, the browser interprets the injected content as active HTML/JavaScript rather than as plain text, enabling stored XSS.

Potential impact

  • Theft of user session data (e.g., cookies if not properly protected)
  • Execution of arbitrary JavaScript in the context of the Docmost application
  • Unauthorized actions performed on behalf of the victim (e.g., modifying content, changing settings) via CSRF-like behavior within the same origin
  • Phishing or UI redressing attacks, such as injecting deceptive content or prompts
  • Exfiltration of sensitive information accessible within the victim's browser context

General mitigation guidance

Effective mitigation focuses on robust output encoding and strict handling of untrusted data in HTML:

  • Apply context-aware escaping for all user-supplied values rendered into HTML, ensuring page titles are properly HTML-escaped before insertion into meta and title tags.
  • Use templating engines or frameworks that default to safe escaping and avoid raw HTML injections, especially in layout and head sections.
  • Treat all user-controlled fields (titles, descriptions, custom labels) as untrusted input and avoid interpreting them as HTML; prefer plain-text rendering.
  • Introduce defense-in-depth controls such as a strong Content Security Policy (CSP) that limits inline script execution and restricts script sources.
  • Follow least-privilege principles in the application UI so that actions available via the browser are minimized for compromised sessions.

How teams detect issues like this

Detection typically involves a combination of automated and manual techniques:

  • Static analysis: Scan templates and server-side rendering code for direct insertion of user-controlled variables into HTML without escaping, especially in head/meta/title sections.
  • Security-focused code review: Flag any use of raw HTML output methods or bypasses of the default escaping mechanisms.
  • Dynamic application testing: Use automated and manual tests that insert typical XSS payload markers into page titles and verify whether they execute when viewing public share pages.
  • Policy enforcement in CI/CD: Add checks or linters that disallow rendering functions known to output unescaped content, and enforce secure coding guidelines for view templates.

Sources

SourceLink
github.comgithub.com/docmost/docmost/commit/f3f74c591f32f85b8aa9a98ed884a7dd455780f9
github.comgithub.com/docmost/docmost/releases/tag/v0.25.0
github.comgithub.com/docmost/docmost/security/advisories/GHSA-h7fp-4f37-29wq

Frequently asked

questions

Yes. If an attacker can create or modify a page title and obtain a public share link, they can send that link to victims. When a victim opens the link in a browser, the injected script can execute.

Exploitation generally requires the ability to control a page's title that is shared publicly, which typically means having a valid account or permissions to edit content. Victims, however, may not need to be authenticated; any user opening the malicious share link can be affected.

Ensure that all user-controlled data is properly escaped before being inserted into HTML, using context-appropriate output encoding. Avoid raw HTML rendering paths and rely on frameworks or templating engines that enforce safe defaults.

Adopt a secure coding standard that mandates output encoding for untrusted data, use libraries that handle escaping automatically, include XSS-specific checks in code review and automated testing, and consider deploying a restrictive CSP as an additional safety net.

Find out what's already
exploitable in your codebase.