[CVE-2015-7578] Possible XSS vulnerability in rails-html-sanitizer

5,484 views
Skip to first unread message

Aaron Patterson

unread,
Jan 25, 2016, 2:34:27 PM1/25/16
to secu...@suse.de, rubyonrail...@googlegroups.com, oss-se...@lists.openwall.com, ruby-sec...@googlegroups.com
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

--
Aaron Patterson
http://tenderlovemaking.com/
1-0-sanitize_data_attributes.patch

Aaron Patterson

unread,
Jan 25, 2016, 2:39:02 PM1/25/16
to secu...@suse.de, rubyonrail...@googlegroups.com, oss-se...@lists.openwall.com, ruby-sec...@googlegroups.com
Possible XSS vulnerability in rails-html-sanitizer

There is a possible XSS vulnerability in the white list sanitizer in the
rails-html-sanitizer gem. This vulnerability has been assigned the CVE
identifier CVE-2015-7580.

Versions Affected: All.
Not affected: None.
Fixed Versions: v1.0.3

Impact
------
Carefully crafted strings can cause user input to bypass the sanitization in
the white list sanitizer which will can lead to an XSS attack.

Vulnerable code will look something like this:

<%= sanitize user_input, tags: %w(em) %>

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
-----------
Putting the following monkey patch in an initializer can help to mitigate the
issue:

```
class Rails::Html::PermitScrubber
alias :old_scrub :scrub
alias :old_skip_node? :skip_node?

def scrub(node)
if node.cdata?
text = node.document.create_text_node node.text
node.replace text
return CONTINUE
end
old_scrub node
end

def skip_node?(node); node.text?; end
end
```

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

Credits
-------
Thanks to Arnaud Germis, Nate Clark, and John Colvin for reporting this issue.
1-0-whitelist_sanitizer_xss.patch
Reply all
Reply to author
Forward
0 new messages