| Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
|---|---|---|---|
| rails-html-sanitizer | rubygems | = 1.6.0 | 1.6.1 |
The vulnerability stems from improper tag validation in the PermitScrubber class. The commit diff shows critical modifications to the validate! method in scrubbers.rb where 'mglyph' and 'malignmark' are now explicitly removed from allowed tags. This indicates the original vulnerability existed in this validation logic when processing user-configured allowed tags. The function is central to tag whitelisting and its pre-patch behavior allowed dangerous combinations of tags that enabled XSS.
allowed_tags:# class-level option
Rails::HTML5::SafeListSanitizer.allowed_tags = ["math", "mtext", "table", "style", "mglyph"]
# or
Rails::HTML5::SafeListSanitizer.allowed_tags = ["math", "mtext", "table", "style", "malignmark"]
(note that this class may also be referenced as Rails::Html::SafeListSanitizer)
:tags options to the Rails::HTML5::SafeListSanitizer instance method sanitize:# instance-level option
Rails::HTML5::SafeListSanitizer.new.sanitize(@article.body, tags: ["math", "mtext", "table", "style", "mglyph"])
# or
Rails::HTML5::SafeListSanitizer.new.sanitize(@article.body, tags: ["math", "mtext", "table", "style", "malignmark"])
(note that this class may also be referenced as Rails::Html::SafeListSanitizer)
allowed_tags:ActionText::ContentHelper.allowed_tags = ["math", "mtext", "table", "style", "mglyph"]
# or
ActionText::ContentHelper.allowed_tags = ["math", "mtext", "table", "style", "malignmark"]
All users overriding the allowed tags by any of the above mechanisms to include ("math" and "mtext" and "table" and "style" and ("mglyph" or "malignmark")) should either upgrade or use one of the workarounds.
Any one of the following actions will work around this issue:
config.action_view.sanitizer_vendor and config.action_text.sanitizer_vendor for more information).KEV Misses 88% of Exploited CVEs- Get the report