Summary
Wiki.js can allow an authenticated user with page-writing access to store executable Vue expressions in certain page attributes. When another user views the page, those expressions may run in that user's browser under the Wiki.js origin, even if the author lacks script-writing or administrative permissions.
Affected context
The issue occurs when Wiki.js processes page HTML containing Vue directives in the v-slot:tabs or v-slot:content attributes. These directives are permitted by the HTML sanitization allowlist, and the resulting content is later compiled by the Vue 2 runtime compiler. Risk depends on an authenticated user being able to write pages and another user viewing the affected page.
Exploit preconditions
- Attack surface: Wiki.js pages rendered in a viewer's browser
- Required access: An authenticated account with
write:pagespermission; administrative access andwrite:scriptspermission are not required - Trigger point: A viewer opens a page containing the stored attributes
- Why exploitation is possible: Sanitization allows executable Vue directives that are later compiled as part of rendered page HTML
Why this happens
The renderer adds executable Vue directives to the DOMPurify allowlist, then passes the sanitized HTML to a Vue 2 runtime compiler. This allows attacker-controlled expressions in stored page content to execute in a viewer's browser. The issue maps to CWE-79: Improper Neutralization of Input During Web Page Generation (Cross-site Scripting) because untrusted content is not sufficiently constrained before being rendered as executable browser content.
Potential impact
- Attacker-controlled script may read same-origin data available to the viewer
- Script could modify displayed content or present phishing content
- Script could perform actions available to the viewer
- If a privileged user views the page, script could potentially invoke operations available to that user's session, including privileged GraphQL operations
General mitigation guidance
Defensive patterns focus on preventing untrusted page content from becoming executable:
- Avoid passing untrusted HTML to runtime template compilers
- Remove executable framework directives from sanitizer allowlists
- Prefer rendering user-provided content as text or through a restricted, non-executable markup format
- Apply strict schema and attribute allowlists based on the content's intended use
- Limit page-writing permissions and apply least privilege to user roles
- Use browser security policies, such as a carefully configured Content Security Policy, as defense in depth
How teams detect issues like this
- Use static analysis to identify paths where sanitized HTML is passed to framework runtime compilers
- Review sanitizer allowlists for executable directives, event handlers, and other active attributes
- Test page rendering with security checks that verify user-controlled markup cannot execute in a browser
- Enforce code-review and CI policies against compiling untrusted HTML or expanding active markup allowlists without review
- Monitor for unusual same-origin actions associated with page views, while accounting for legitimate user activity

