search menu icon-carat-right cmu-wordmark

CERT Coordination Center

Ruby on Rails 3.0 and 2.3 JSON Parser vulnerability

Vulnerability Note VU#628463

Original Release Date: 2013-01-28 | Last Revised: 2013-03-11

Overview

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

Description

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

Impact
- ------
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.

Impact

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

Solution

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

628463
 

Ruby on Rails Affected

Updated:  January 28, 2013

Status

Affected

Vendor Statement

We have not received a statement from the vendor.

Vendor Information

We are not aware of further vendor information regarding this vulnerability.


CVSS Metrics

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

References

Acknowledgements

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: 2013-01-28
Date First Published: 2013-01-28
Date Last Updated: 2013-03-11 17:57 UTC
Document Revision: 10

Sponsored by CISA.