Summary
code16 Sharp contains a stored cross-site scripting vulnerability in the SharpEditorFormField component. Attacker-controlled content using the data-html-content attribute may bypass sanitization and preserve executable markup, which could run when another user views the stored content.
Affected context
The vulnerability may occur in Sharp applications using SharpEditorFormField to accept and store editor content. Risk is increased when attacker-controlled users can submit content, the RAW_HTML functionality is enabled, or editor content is rendered without effective sanitization before storage or display.
Exploit preconditions
- Attack surface: Sharp editor forms and pages that render stored editor content
- Required access: Ability to submit or influence content saved through an editor field
- Trigger point: A victim views the stored content in a Sharp interface or other rendering context
- Why exploitation is possible: The data-html-content attribute can bypass HTML sanitization, allowing executable markup to remain in persisted content
Why this happens
The underlying issue is insufficient output and input sanitization for attacker-controlled HTML associated with SharpEditorFormField. Content represented through the data-html-content attribute can evade the intended sanitization boundary and remain executable when later rendered. This maps to CWE-79: Improper Neutralization of Input During Web Page Generation, commonly known as cross-site scripting.
Potential impact
- Malicious script execution in another user's browser
- Theft of accessible session data or sensitive page content
- Unauthorized actions performed with a victim's privileges
- Defacement or manipulation of administrative and content-management interfaces
- Persistence of malicious content across multiple user sessions
General mitigation guidance
Mitigation generally focuses on making sanitization consistent across every editor-content trust boundary.
Common defensive patterns include:
- Applying a well-configured HTML sanitizer before storing or rendering editor content
- Using secure-by-default editor modes that do not permit raw HTML
- Disabling RAW_HTML functionality where it is not necessary
- Allowing only a narrowly defined HTML element and attribute policy
- Encoding content by default when rich HTML rendering is not required
- Restricting editor permissions according to least privilege
- Treating previously stored editor content as untrusted and reviewing it after controls change
Applications that intentionally require raw HTML should maintain an explicit, independently enforced sanitization policy.
How teams detect issues like this
Organizations can look for this class of issue through:
- Static analysis and code review of editor fields, HTML rendering, and sanitization paths
- Searches for RAW_HTML usage and direct rendering of user-controlled content
- Tests containing harmless markup variants in data-html-content and related editor attributes
- Content-security policy monitoring for unexpected script execution or violations
- Policy checks requiring approved HTML sanitizers before persistence or output
Automated security review tools may help identify dangerous rendering patterns, but findings should be verified against the application's actual content flow.

