MediumGHSA-m46p-ggm5-5j83CVE-2014-0081

Rails vulnerable to Cross-site Scripting

Published 24 Oct 2017 · Updated 8 Dec 2024

Is your project on an affected rails?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Rails or Ruby apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected packages

railsRubyGems
Affected
>=3.0.0 <3.2.17
Fixed in
3.2.17
Update to the fixed version for your release line, for example:bundle update --conservative rails # Gemfile: '>= 3.2.17'
railsRubyGems
Affected
>=4.0.0 <4.0.3
Fixed in
4.0.3
Update to the fixed version for your release line, for example:bundle update --conservative rails # Gemfile: '>= 4.0.3'
actionpackRubyGems
Affected
>=3.0.0 <3.2.17
Fixed in
3.2.17
Update to the fixed version for your release line, for example:bundle update --conservative actionpack # Gemfile: '>= 3.2.17'
actionpackRubyGems
Affected
>=4.0.0 <4.0.3
Fixed in
4.0.3
Update to the fixed version for your release line, for example:bundle update --conservative actionpack # Gemfile: '>= 4.0.3'

Details

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/

Is GHSA-m46p-ggm5-5j83 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected rails, and gives you the command that fixes it.

More advisories for rails

  • MediumCVE-2024-26143Rails has possible XSS Vulnerability in Action Controller · 27 Feb 2024
  • CriticalCVE-2009-2422rails vulnerable to improper authentication · 24 Oct 2017
  • HighCVE-2006-4112Rails Denial of Service vulnerability · 24 Oct 2017
  • HighCVE-2006-4111Ruby on Rails vulnerable to code injection · 24 Oct 2017
  • MediumCVE-2009-4214Moderate severity vulnerability that affects rails · 24 Oct 2017
  • MediumCVE-2007-5379Moderate severity vulnerability that affects rails · 24 Oct 2017
All 11 advisories for rails

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.