Summary
Rails vulnerable to Cross-site Scripting
There is an XSS vulnerability in the number_to_currency, number_to_percentage and number_to_human 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, negative_format 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:
<%= number_to_currency(1.02, format: params[:format]) %>
With code like this
<%= number_to_currency(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-number_helpers_xss.patch - Patch for 4.1-beta series
- 4-0-number_helpers_xss.patch - Patch for 4.0 series
- 3-2-number_helpers_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 Kevin Reintjes for reporting the issue to us.
--
Aaron Patterson
http://tenderlovemaking.com/
Impact
Untrusted input is rendered as active markup in a victim's browser, which can run script in their session. Typical impact: session or credential theft, and actions taken as the user.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Already deployed Kodem?
See it in your environmentNew to Kodem? Get a demo →Remediation advice
rails to 3.2.17 or later; rails to 4.0.3 or later; actionpack to 3.2.17 or later; actionpack to 4.0.3 or later
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2014-0081? CVE-2014-0081 is a medium-severity cross-site scripting (XSS) vulnerability in rails (rubygems), affecting versions >= 3.0.0, < 3.2.17. It is fixed in 3.2.17, 4.0.3. Untrusted input is rendered as active markup in a victim's browser, which can run script in their session.
- Which packages are affected by CVE-2014-0081?
rails(rubygems) (versions >= 3.0.0, < 3.2.17)actionpack(rubygems) (versions >= 3.0.0, < 3.2.17)
- Is there a fix for CVE-2014-0081? Yes. CVE-2014-0081 is fixed in 3.2.17, 4.0.3. Upgrade to this version or later.
- Is CVE-2014-0081 exploitable, and should I be worried? Whether CVE-2014-0081 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2014-0081 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2014-0081?
- Upgrade
railsto 3.2.17 or later - Upgrade
railsto 4.0.3 or later - Upgrade
actionpackto 3.2.17 or later - Upgrade
actionpackto 4.0.3 or later
- Upgrade