Summary
Strapi contains a stored cross-site scripting vulnerability in the content manager's WYSIWYG preview component, which may fail to remove script tags from rich text content. An Author-role user could store malicious content that executes in an Editor or Super Admin's browser session when the preview pane is expanded, potentially enabling account takeover.
Affected context
The vulnerability occurs in Strapi content management deployments that use affected 4.x or 5.x releases and expose the WYSIWYG preview for rich text fields. Risk depends on an Author-role user being able to submit or save rich text that is later rendered in a higher-privileged user's authenticated management session.
Exploit preconditions
- Attack surface: Strapi content manager WYSIWYG preview component
- Required access: Author-role access sufficient to create or modify rich text content
- Trigger point: An Editor or Super Admin expands the preview pane containing the stored content
- Why exploitation is possible: Script elements are not consistently removed or neutralized before the rich text is rendered in the privileged management interface
Why this happens
The underlying issue is insufficient output encoding or sanitization of user-controlled rich text before it is rendered as HTML in the administrative interface. When script-capable markup is preserved and interpreted by the browser, attacker-controlled content executes in the security context of the viewing user. This behavior maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.
Potential impact
- An attacker may execute JavaScript in an Editor's or Super Admin's browser session
- Session data or sensitive administrative information could be exposed
- Administrative actions could be performed on behalf of a targeted user
- A privileged account may be compromised or taken over
- Malicious content could be propagated through managed entries or workflows
General mitigation guidance
Mitigation generally focuses on treating all author-supplied rich text as untrusted and ensuring it cannot execute active browser content.
Common defensive patterns include:
- Applying context-aware HTML sanitization with an allowlist of required elements and attributes
- Encoding or safely rendering rich text before inserting it into the DOM
- Removing script-capable tags, event-handler attributes, unsafe URLs, and other active content
- Enforcing consistent sanitization at both content ingestion and preview-rendering boundaries
- Limiting Author permissions to the content operations they need
- Using browser security policies, such as an appropriately restrictive Content Security Policy, as defense in depth
- Avoiding privileged sessions for untrusted preview content where practical
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis of rich text rendering paths for unsafe HTML insertion or direct DOM APIs
- Code review checks for missing sanitization, weak allowlists, and inconsistent preview handling
- Tests that verify script tags, event attributes, unsafe URI schemes, and malformed HTML are neutralized
- Dynamic security testing of content fields and preview panes using non-destructive XSS test cases
- Content governance policies that restrict who can submit markup and require review before publication
- Automated code and dependency review tools that flag common cross-site scripting patterns

