Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [day] [month] [year] [list]
Date: Mon, 18 Mar 2013 10:23:18 -0700
From: Aaron Patterson <tenderlove@...y-lang.org>
To: rubyonrails-security@...glegroups.com, oss-security@...ts.openwall.com,
	ruby-security-ann@...glegroups.com
Subject: [CVE-2013-1857] XSS Vulnerability in the `sanitize` helper of Ruby
 on Rails

XSS Vulnerability in the `sanitize` helper of Ruby on Rails

There is an XSS vulnerability in the sanitize helper in Ruby on Rails. This vulnerability has been assigned the CVE identifier CVE-2013-1857.

Versions Affected:  All.
Not affected:       None.
Fixed Versions:     3.2.13, 3.1.12, 2.3.18

Impact
------
The sanitize helper in Ruby on Rails is designed to filter HTML and remove all tags and attributes which could be malicious.  The code which ensured that URLs only contain supported protocols contained several bugs which could allow an attacker to embed a tag containing a URL which executes arbitrary javascript code.

All users running an affected release should either upgrade or use one of the work arounds immediately.

Releases
--------
The 3.2.13 and 3.1.12 releases are available at the normal locations.

Workarounds
-----------
If you are unable to upgrade, you can place the following code into a file in config/initializers and it will replace the method with the correct implementation.

  module HTML
    class WhiteListSanitizer
      self.protocol_separator = /:|(&#0*58)|(&#x70)|(&#x0*3a)|(%|&#37;)3A/i

      def contains_bad_protocols?(attr_name, value)
        uri_attributes.include?(attr_name) &&
        (value =~ /(^[^\/:]*):|(&#0*58)|(&#x70)|(&#x0*3a)|(%|&#37;)3A/i && !allowed_protocols.include?(value.split(protocol_separator).first.downcase.strip))
      end
    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.

* 3-2-sanitize_protocol.patch - Patch for 3.2 series
* 3-1-sanitize_protocol.patch - Patch for 3.1 series
* 3-0-sanitize_protocol.patch - Patch for 3.0 series
* 2-3-sanitize_protocol.patch - Patch for 2.3 series

Please note that only the 3.1.x and 3.2.x series are supported at present.  Users of earlier unsupported releases are advised to upgrade as soon as possible as we cannot guarantee the continued availability of security fixes for unsupported releases.

Credits
-------

Thanks to Alan Jenkins <alan.christopher.jenkins@...il.com> for reporting the
vulnerability to us.

-- 
Aaron Patterson
http://tenderlovemaking.com/

View attachment "2-3-sanitize_protocol.patch" of type "text/plain" (3550 bytes)

View attachment "3-0-sanitize_protocol.patch" of type "text/plain" (3271 bytes)

View attachment "3-1-sanitize_protocol.patch" of type "text/plain" (3280 bytes)

View attachment "3-2-sanitize_protocol.patch" of type "text/plain" (3281 bytes)

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.