XSS vulnerability in sanitize-method when parsing link's href
The rails-html-sanitizer gem allowed non-whitelisted attributes to remain in sanitised output when given specially crafted HTML fragments, which could lead to XSS attacks on applications using the gem.
- Triaged in 4 hours
- Fixed in 28 hours
- Paid in 28 hours
- Disclosed after 29 hours
Summary by the program
Possible XSS vulnerability in rails-html-sanitizer
There is a possible XSS vulnerability in rails-html-sanitizer. This vulnerability has been assigned the CVE identifier CVE-2018-3741.
Versions Affected: 1.0.3 or older. Not affected: None. Fixed Versions: 1.0.4
Impact
There is a possible XSS vulnerability in rails-html-sanitizer. The gem allows non-whitelisted attributes to be present in sanitized output when input with specially-crafted HTML fragments, and these attributes can lead to an XSS attack on target applications.
This issue is similar to CVE-2018-8048 in Loofah.
All users running an affected release should either upgrade or use one of the workarounds immediately.
Releases
The FIXED releases are available at the normal locations.
Workarounds
There are no feasible workarounds for this issue.
Patches
To aid users who aren't able to upgrade immediately we have provided patches for the two supported release series. They are in git-am format and consist of a single changeset.
- 1-0-sanitize_attributes.patch - Patch for 1.0 series
Credits
Thanks to Kaarlo Haikonen for reporting this issue and Mike Dalessio for providing the original fix in the Loofah gem.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the sanitizer's attribute filtering did not properly handle certain crafted HTML fragments, allowing non-whitelisted attributes to pass through.
Impact
An attacker could execute scripts in a victim's browser (XSS) if the application used the vulnerable gem to sanitise user-supplied HTML.
What the attacker needed
Application uses rails-html-sanitizer 1.0.3 or older; attacker can supply HTML input to the application
The fix
The issue was fixed in version 1.0.4; users should upgrade.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A sanitizer is a tool that cleans HTML to remove dangerous parts. This gem failed to remove some attributes that were not on its allowed list, so an attacker could sneak in harmful code that runs in a victim's browser.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.