oss-sec mailing list archives

[CVE-2013-6415] XSS Vulnerability in number_to_currency


From: Aaron Patterson <tenderlove () ruby-lang org>
Date: Tue, 3 Dec 2013 11:08:53 -0800

XSS Vulnerability in number_to_currency

There is an XSS vulnerability in the number_to_currency helper in Ruby on Raile. This vulnerability has been assigned 
the CVE identifier CVE-2013-6415.

Versions Affected:  All.
Fixed Versions:     4.0.2, 3.2.16.

Impact 
------ 
The number_to_currency helper allows users to nicely format a numeric value. One of the parameters to the helper (unit) 
is not escaped correctly.  Application which pass user controlled data as the unit parameter are vulnerable to an XSS 
attack.

All users passing user controlled data as number_to_currency's unit parameters should either upgrade or use one of the 
workarounds immediately. 

Releases 
-------- 
The 4.0.2 and 3.2.16 releases are available at the normal locations. 

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

The workaround for this issue is to escape the value passed to the :unit parameter.  For example, replace code like 
this:

  <%= number_to_currency(1.02, unit: params[:currency]) %>

With code like this

  <%= number_to_currency(1.02, unit: h(params[:currency])) %>

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. 

* 4-0-number_to_currency_xss.patch - Patch for 4.0 series 
* 3-2-number_to_currency_xss.patch - Patch for 3.2 series 

Please note that only the 4.0.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 Ankit Gupta for reporting the issue to us and working with us on a fix.

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

Attachment: 3-2-number_to_currency_xss.patch
Description:

Attachment: 4-0-number_to_currency_xss.patch
Description:

Attachment: _bin
Description:


Current thread: