The vulnerability is a stored Cross-Site Scripting (XSS) issue within the Statamic CMS, specifically in the command palette feature. The analysis of the security advisory and the associated patch in pull request #13825 reveals that the flaw was in how search results were handled and displayed.
The root cause is the lack of input sanitization in the CommandPalette.vue component. An authenticated user with permissions to create or edit content could insert a malicious JavaScript payload into a content title. When another user, particularly a higher-privileged one like an administrator, uses the command palette, the search functionality fetches these content titles. The vulnerable code, located in the results computed property, would then use the fuzzysort library to highlight matching text. Crucially, the fuzzysort.highlight function was called on the raw, unsanitized title. This process wrapped the malicious script in highlighting tags without escaping it, and the resulting HTML was rendered in the command palette, causing the script to execute in the administrator's browser. This could be leveraged for privilege escalation, such as creating a new admin user.
The patch addresses this by introducing a new function, highlightResult, which wraps the highlighting logic. This new function first calls escapeHtml on the text, ensuring that any embedded HTML or script tags are converted to inert text before the highlighting is applied. This prevents the browser from executing the malicious payload.