Skip to content
XSS Disclosed report Intermediate

Data-Tags and the New HTML Sanitizer Subverts CSRF protection

The rails-html-sanitizer library failed to strip certain attributes from tags during sanitisation, so crafted markup could survive cleaning and lead to cross-site scripting in applications that relied on it. An attacker could use this to run script in a victim's browser.

benmmurphy Follow

Originally disclosed on HackerOne

  • Triaged in 22 hours
  • Fixed in 13 months
  • Paid in 3.1 years
  • Disclosed after 14 months

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-2015-7578.

Versions Affected: All. Not affected: None. Fixed Versions: 1.0.3

Impact

There is a possible XSS vulnerability in rails-html-sanitizer. Certain attributes are not removed from tags when they are sanitized, and these attributes can lead to an XSS attack on target applications.

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_data_attributes.patch - Patch for 1.0 series

Credits

Thanks to Ben Murphy and Marien for reporting this

The original report as published on HackerOne, by benmmurphy. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

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 sanitiser's attribute allow/deny logic failed to account for certain attributes (such as data-* attributes) that browsers can still act on, so they were left in the cleaned output.

Impact

Because the leftover attributes could lead to script execution, an attacker could carry out an XSS attack on applications using the affected library.

What the attacker needed

Application uses rails-html-sanitizer; attacker can supply HTML that is sanitised

The fix

It was fixed in version 1.0.3, and patches were provided for the 1.0 series.

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 sanitiser cleans user-supplied HTML so dangerous parts are removed. Here some attributes were not removed, so harmful markup could slip through and lead to cross-site scripting. A fixed version and patches were released.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from Ruby on Rails

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.