CVE-2014-0081: XSS
Multiple cross-site scripting (XSS) vulnerabilities in actionview/lib/actionview/helpers/numberhelper.rb in Ruby on Rails before 3.2.17, 4.0.x before 4.0.3, and 4.1.x before 4.1.0.beta2 allow remote attackers to inject arbitrary web script or HTML via the (1) format, (2) negativeformat, or (3) units parameter to the (a) numbertocurrency, (b) numbertopercentage, or (c) numbertohuman helper.
Other sources
There is an XSS vulnerability in the numbertocurrency, numbertopercentage and numbertohuman helpers in Ruby on Rails. This vulnerability has been assigned the CVE identifier CVE-2014-0081.
Versions Affected: All. Fixed Versions: 4.1.0.beta2, 4.0.3, 3.2.17.
Impact ------ These helpers allows users to nicely format a numeric value. Some of the parameters to the helper (format, negativeformat and units) are not escaped correctly. Applications which pass user controlled data as one of these parameters are vulnerable to an XSS attack.
All users passing user controlled data to these parameters of the number helpers should either upgrade or use one of the workarounds immediately.
Releases -------- The 4.1.0.rc1, 4.0.3 and 3.2.17 releases are available at the normal locations.
Workarounds -----------
The workaround for this issue is to escape the value passed to the parameter. For example, replace code like this:
ruby <%= numbertocurrency(1.02, format: params[:format]) %>
With code like this
ruby <%= numbertocurrency(1.02, format: h(params[:format])) %>
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-1-beta-numberhelpersxss.patch - Patch for 4.1-beta series 4-0-numberhelpersxss.patch - Patch for 4.0 series 3-2-numberhelpersxss.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 Kevin Reintjes for reporting the issue to us.
-- Aaron Patterson http://tenderlovemaking.com/
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
rubygems/actionpackto a version that resolves this vulnerability.Fixed in 4.0.3 - Upgrade
Upgrade
rubygems/actionpackto a version that resolves this vulnerability.Fixed in 3.2.17 - Upgrade
Upgrade
rubygems/railsto a version that resolves this vulnerability.Fixed in 4.0.3 - Upgrade
Upgrade
rubygems/railsto a version that resolves this vulnerability.Fixed in 3.2.17 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.1.0.beta2 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 4.0.3 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 3.2.17 - Compensating control
Workaround if you cannot upgrade: escape the value passed to the number helper parameters (format, negative_format, units) for number_to_currency, number_to_percentage, and number_to_human in actionview/lib/action_view/helpers/number_helper.rb.
Event History
Frequently Asked Questions
What is the severity of CVE-2014-0081?
CVE-2014-0081 is classified as a high severity vulnerability due to the potential for remote code execution through cross-site scripting (XSS).
How do I fix CVE-2014-0081?
To fix CVE-2014-0081, you should upgrade Ruby on Rails to version 3.2.17, 4.0.3, or later versions to eliminate the vulnerabilities.
What are the affected versions by CVE-2014-0081?
CVE-2014-0081 affects Ruby on Rails versions before 3.2.17, 4.0.x before 4.0.3, and 4.1.x before 4.1.0.beta2.
Who is impacted by CVE-2014-0081?
Any application using affected versions of Ruby on Rails is potentially vulnerable to remote attacks exploiting XSS.
What types of vulnerabilities are associated with CVE-2014-0081?
CVE-2014-0081 involves multiple cross-site scripting (XSS) vulnerabilities allowing attackers to inject arbitrary web script or HTML.