Advisory

GHSA-rxcw-mc6f-6hr3

Details, part 2 of 2. The advisory

Details

Positive control, same run: a plain <img src=x onerror=alert(1)>, a plain <img onfocus=alert(1) autofocus tabindex=1>, and a plain <svg onload=alert(1)> are all stripped by the synchronous value-set pass to harmless output, proving clean-html is active; the same handlers pass through only when carrier-hidden as <style> rawtext, so the contrast isolates the rawtext-hiding step. (A plain <script> is a separate case - the value-set pass does not remove tags; only the async on-change cleaner removes it ~300ms later - so it is not part of this synchronous control.)

Carrier variants: three of the four layers accept substitutes: the MathML text-integration point (mtext / mi / ms / mn / mo), the integration-point child (mglyph / malignmark), and the rawtext element (style / xmp / noembed / script / plaintext; title / textarea / noscript do not work). math and table have no working substitute. The hidden element is not limited to <img>, and any non-onerror handler persists permanently. Element-name blocklisting will not close this.

Impact
Stored XSS with no user interaction, in the default configuration, on the input paths that jodit's own clean-html is responsible for sanitizing. jodit's own test suite asserts this is a sanitization boundary: src/plugins/clean-html/clean-html.test.js asserts that editor.value = '<p>test <img src="" onerror="alert(111)" alt=""></p>' sanitizes to <p>test <img src="" alt=""></p> (the onerror removed) under the default config. The carrier in this report passes that same default-config sanitizer yet keeps the handler live, defeating the asserted guarantee. A prior fix in 4.12.21 addressed a stored XSS premised on an application re-rendering editor.value as trusted HTML, so this threat model is maintainer-acknowledged. Precondition: an attacker can place HTML into the editor (a content-submission role) and the editor output is later rendered. Any integration binding value to application state in jodit-react, loading a previously stored document, or inserting content via a plugin/button will execute attacker script in the victim's page.

Suggested fix
Remove the gadget element at the source rather than re-sanitizing the output. A re-sanitize loop does not close this: nesting the carrier inside itself surfaces one level per parse, so one extra pass is bypassed at depth 2, and any fixed cap N is out-nested at depth N+2 (depth generalizes trivially). The robust fix is to drop any HTML-namespace element smuggled inside <math>/<svg> outside a spec integration point (<foreignObject>, <annotation-xml>, <desc>, <title>) during the element walk, the same approach DOMPurify's _checkValidNamespace uses. This is one pass and depth-independent. It must run on both entry points: the synchronous value-set safeHTML pass and the on-change walker (which does not call safeHTML). A regression test asserting that no on* survives a round-trip through editor.value, including the nested-carrier case, locks it in.

Sources & licences