CVE-2014-0081: Rails Cross-Site Scripting Vulnerability

MODERATE
Advisory Identifier: GHSA-m46p-ggm5-5j83
CWE-79
Published
Advisory Summary

CVE-2014-0081 is a MODERATE cross-site scripting vulnerability (CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')) affecting Rails libraries in the RubyGems ecosystem. The issue involves rails vulnerable to cross-site scripting. Remediation is available by upgrading affected packages to version 3.2.17, 4.0.3.

CVE-2014-0081 at a Glance

CVE Identifier CVE-2014-0081
GHSA Identifier GHSA-m46p-ggm5-5j83
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
Affected Product Rails
Package Ecosystem RubyGems
Published Date
Last Updated

How to Fix CVE-2014-0081

To remediate this vulnerability, upgrade all affected Rails dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

rails fixed: 3.2.17
Upgrade rails to 3.2.17
rails fixed: 4.0.3
Upgrade rails to 4.0.3
actionpack fixed: 3.2.17
Upgrade actionpack to 3.2.17
actionpack fixed: 4.0.3
Upgrade actionpack to 4.0.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for rails

How to Check if You Are Affected

To determine whether your application is affected by CVE-2014-0081, inspect your project dependencies for Rails:

inspect dependencies for rails

Analyze the terminal output to locate any version of Rails in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.2.17), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting'), where the product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users. In Rails, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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: ```ruby <%= number_to_currency(1.02, format: params[:format]) %> ``` With code like this ```ruby <%= 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/

CVE-2014-0081 Affected Rails Versions

4 component(s)
Fixed Versions:
3.2.174.0.3
Product / Package Ecosystem Affected Versions Fixed Version
rails
RubyGems
≥ 3.0.0
< 3.2.17
3.2.17
rails
RubyGems
≥ 4.0.0
< 4.0.3
4.0.3
actionpack
RubyGems
≥ 3.0.0
< 3.2.17
3.2.17
actionpack
RubyGems
≥ 4.0.0
< 4.0.3
4.0.3

References

Frequently Asked Questions

What is CVE-2014-0081?
CVE-2014-0081 is a security vulnerability in Rails involving Rails vulnerable to Cross-site Scripting under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting').
Which Rails versions are affected?
Affected versions include releases prior to 3.2.17, 4.0.3 across affected packages: rails, actionpack.
What version fixes CVE-2014-0081?
Upgrading to 3.2.17, 4.0.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is rails affected?
Yes, rails is affected in releases prior to 3.2.17, 4.0.3. Upgrade your dependency to 3.2.17, 4.0.3 or later.
Is actionpack affected?
Yes, actionpack is affected in releases prior to 3.2.17, 4.0.3. Upgrade your dependency to 3.2.17, 4.0.3 or later.
What CWE is associated with CVE-2014-0081?
CVE-2014-0081 is classified under CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting') (The product does not neutralize or incorrectly neutralizes user-controllable input before it is placed in output that is used as a web page that is served to other users.).
How can I check RubyGems dependencies for CVE-2014-0081?
Run the dependency tree command: 'inspect dependencies for rails'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-m46p-ggm5-5j83",
  "modified" : "2023-07-05T20:33:59Z",
  "published" : "2017-10-24T18:33:36Z",
  "aliases" : [ "CVE-2014-0081" ],
  "summary" : "Rails vulnerable to Cross-site Scripting",
  "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.\n\nVersions Affected:  All.\nFixed Versions:     4.1.0.beta2, 4.0.3, 3.2.17.\n\nImpact\n------\nThese 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.\n\nAll users passing user controlled data to these parameters of the number helpers should either upgrade or use one of the workarounds immediately.\n\nReleases\n--------\nThe 4.1.0.rc1, 4.0.3 and 3.2.17 releases are available at the normal locations.\n\nWorkarounds\n-----------\n\nThe workaround for this issue is to escape the value passed to the parameter.\nFor example, replace code like this:\n\n```ruby\n<%= number_to_currency(1.02, format: params[:format]) %>\n```\n\nWith code like this\n\n```ruby\n<%= number_to_currency(1.02, format: h(params[:format])) %>\n```\n\nPatches\n-------\nTo 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.\n\n* 4-1-beta-number_helpers_xss.patch - Patch for 4.1-beta series\n* 4-0-number_helpers_xss.patch - Patch for 4.0 series\n* 3-2-number_helpers_xss.patch - Patch for 3.2 series\n\nPlease 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.\n\nCredits\n-------\n\nThanks to Kevin Reintjes for reporting the issue to us.\n\n-- \nAaron Patterson\nhttp://tenderlovemaking.com/\n",
  "severity" : [ ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "rails"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.2.17"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "rails"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.0.3"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "actionpack"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "3.0.0"
      }, {
        "fixed" : "3.2.17"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "RubyGems",
      "name" : "actionpack"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.0.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2014-0081"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rails/rails/commit/08d0a11a3f62718d601d39e617c834759cf59bbb"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/rails/rails"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/actionpack/CVE-2014-0081.yml"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/rubysec/ruby-advisory-db/blob/master/gems/rails/CVE-2014-0081.yml"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20140911141416/http://www.securitytracker.com/id/1029782"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20170307202606/http://www.securityfocus.com/bid/65647"
  }, {
    "type" : "WEB",
    "url" : "https://web.archive.org/web/20201207045136/https://groups.google.com/forum/message/raw?msg=rubyonrails-security/tfp6gZCtzr4/j8LUHmu7fIEJ"
  }, {
    "type" : "WEB",
    "url" : "http://lists.opensuse.org/opensuse-updates/2014-02/msg00081.html"
  }, {
    "type" : "WEB",
    "url" : "http://openwall.com/lists/oss-security/2014/02/18/8"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2014-0215.html"
  }, {
    "type" : "WEB",
    "url" : "http://rhn.redhat.com/errata/RHSA-2014-0306.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-79" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2020-06-16T21:44:48Z",
    "nvd_published_at" : "2014-02-20T15:27:09Z"
  }
}