-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SECURITY] Mitigate XSS in CDATA and HTML raw text elements (#106)
* [SECURITY] Mitigate potential XSS in CDATA sections Due to a parsing issue in upstream package `masterminds/html5`, malicious markup used in a sequence with special HTML CDATA sections cannot be filtered and sanitized. This change mitigates the parsing problem by converting all CDATA section contents to DOM text nodes like show below: - from `<![CDATA[<any><span data-value="value"></any>*/]]>` + to `<any><span data-value="value"></any>*/` In case an individual builder us used, which does not inherit behavior declarations from `TYPO3\HtmlSanitizer\Builder\CommonBuilder`, those implementations need to be adjusted manually. * [SECURITY] Ensure HTML raw text elements are processed Upstream package `masterminds/html5` provides HTML raw text elements (`script`, `style`, `noframes`, `noembed` and (void element) `iframe`) as `DOMText` nodes. Since those text nodes have not been processed by `typo3/html-sanitizer`, sanitization was not applied to mentioned HTML tag names. None of them were defined in the default builder configuration, that's why only custom behaviors, using one of those tag names, were vulnerable to cross-site scripting. In case any of those tags shall be processed as raw text (for instance this would be reasonable for `script type="ld+json"`), the new `Behavior\Tag::ALLOW_INSECURE_RAW_TEXT` flag needs to be used explicitly. Security-References: CVE-2022-23499
- Loading branch information
Showing
5 changed files
with
209 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters