XSS Weakness in strip_tags

388 views
Skip to first unread message

Michael Koziarski

unread,
Nov 26, 2009, 7:44:06 PM11/26/09
to rubyonrail...@googlegroups.com
There is a weakness in the strip_tags function in ruby on rails. Due to
a bug in the parsing code inside HTML::Tokenizer regarding non-printable
ascii characters, an attacker can include values which certain browsers
will then evaluate.

Versions Affected: All versions prior to 2.3.4 or 2.2.s
Not affected: Applications which do not use strip_tags
Fixed Versions: 2.3.5

Impact
------

Applications relying on strip_tags for XSS protection may be vulnerable
to attacks on Internet Explorer users.

Releases
--------

The 2.3.5 releases is available at the normal locations now.

Workarounds
-----------

Users using strip_tags can pass the resulting output to the regular
escaping functionality:

<%= h(strip_tag(...)) %>


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 updating the parser and providing an
additional unit test.

* 2-2-strip_tags.patch - Patch for 2.2 series
* 2-3-strip_tags.patch - Patch for 2.3 series

Please note that only the 2.2.x and 2.3.x series are supported at
present. Users of earlier unsupported releases are advised to upgrade
at their earliest convenience.

Credits
-------
Thanks to Gabe da Silveira for reporting the vulnerability to us and
providing the fix.

--
Cheers,

Koz
2-2-strip_tags.patch
2-3-strip_tags.patch
Reply all
Reply to author
Forward
0 new messages