Vulnerability Note VU#628463

Ruby on Rails 3.0 and 2.3 JSON Parser vulnerability

Original Release date: 28 Jan 2013 | Last revised: 11 Mar 2013


The Ruby on Rails 3.0 and 2.3 JSON parser contain a vulnerability that may result in arbitrary code execution.


The Ruby on Rails advisory states:

    There is a vulnerability in the JSON code for Ruby on Rails which allows attackers to bypass authentication systems, inject arbitrary SQL, inject and execute arbitrary code, or perform a DoS attack on a Rails application. This vulnerability has been assigned the CVE identifier CVE-2013-0333.

    Versions Affected: 2.3.x, 3.0.x
    Not Affected: 3.1.x, 3.2.x, applications using the yajl gem.
    Fixed Versions: 3.0.20, 2.3.16

    - ------
    The JSON Parsing code in Rails 2.3 and 3.0 support multiple parsing backends. One of the backends involves transforming the JSON into YAML, and passing that through the YAML parser. Using a specially crafted payload attackers can trick the backend into decoding a subset of YAML.

    All users running an affected application should upgrade or use the workaround immediately.

    Note: This is a separate vulnerability to CVE-2013-0156, if you are running a 2.3 or 3.0 application you must still take action to protect your application.

Additional details may be found in the full Ruby on Rails advisory.


An unauthenticated attacker using a specifically crafted payload may be able to trick the Ruby on Rails backend into executing arbitrary code.


Apply an Update

Ruby on Rails 3.0.20 and 2.3.16 were released to address this vulnerability.

The Ruby on Rails advisory states the following workarounds as well.

    If you are unable to upgrade, or apply the patches, you can work around this vulnerability by switching backends to the JSONGem backend. Place this code in an application initializer:

    ActiveSupport::JSON.backend = "JSONGem"

    If you are running Ruby 1.8 you will need to ensure that the `json` or `json_pure` gems are installed and in your application's Gemfile. Ruby 1.9 includes this code already.

Vendor Information (Learn More)

VendorStatusDate NotifiedDate Updated
Ruby on RailsAffected-28 Jan 2013
If you are a vendor and your product is affected, let us know.

CVSS Metrics (Learn More)

Group Score Vector
Base 8.8 AV:N/AC:M/Au:N/C:C/I:C/A:N
Temporal 7.7 E:H/RL:OF/RC:C
Environmental 6.1 CDP:MH/TD:M/CR:H/IR:H/AR:L



Thanks to Lawrence Pit of Mirror42 for discovering the vulnerability.

This document was written by Jared Allar.

Other Information

  • CVE IDs: CVE-2013-0333
  • Date Public: 28 Jan 2013
  • Date First Published: 28 Jan 2013
  • Date Last Updated: 11 Mar 2013
  • Document Revision: 10


If you have feedback, comments, or additional information about this vulnerability, please send us email.