CVE-2013-0333: SQL Injection

Published Jan 24, 2013
·
Updated

lib/activesupport/json/backends/yaml.rb in Ruby on Rails 2.3.x before 2.3.16 and 3.0.x before 3.0.20 does not properly convert JSON data to YAML data for processing by a YAML parser, which allows remote attackers to execute arbitrary code, conduct SQL injection attacks, or bypass authentication via crafted data that triggers unsafe decoding, a different vulnerability than CVE-2013-0156.

Other sources

lib/activesupport/json/backends/yaml.rb in Ruby on Rails 2.3.x before 2.3.16 and 3.0.x before 3.0.20 does not properly convert JSON data to YAML data for processing by a YAML parser, which allows remote attackers to execute arbitrary code, conduct SQL injection attacks, or bypass authentication via crafted data that triggers unsafe decoding, a different vulnerability than CVE-2013-0156.

MITRE

The Ruby on Rails project reports:

Vulnerability in JSON Parser in Ruby on Rails 3.0 and 2.3

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

Note: This is a seperate 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.

Releases -------- The 3.0.20 and 2.3.16 releases are available at the normal locations.

Workarounds ----------- To work around this vulnerability you need to switch 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 jsonpure gems are installed and in your application's Gemfile. Ruby 1.9 includes this code already.

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.

2-3-json-parser.patch - Patch for 2.3 series 3-0-json-parser.patch - Patch for 3.0 series

Please note that only the 2.3.x, 3.1.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 Lawrence Pit of Mirror42 for discovering the vulnerability and working responsibly with us to ensure we shipped a fix.

Affected Software

59 affected componentsFixes available
rubygems/activesupport>=3.0.0<3.0.20
3.0.20
rubygems/activesupport>=2.3.2<2.3.16
2.3.16
rubyonrails Rails=2.3.0
rubyonrails Rails=2.3.1
rubyonrails Rails=2.3.2
rubyonrails Rails=2.3.3
rubyonrails Rails=2.3.4
rubyonrails Rails=2.3.9
rubyonrails Rails=2.3.10
rubyonrails Rails=2.3.11
rubyonrails Rails=2.3.12
rubyonrails Rails=2.3.13
rubyonrails Rails=2.3.14
rubyonrails Rails=2.3.15
rubyonrails Rails=3.0.0
rubyonrails Rails=3.0.0-beta
rubyonrails Rails=3.0.0-beta2
rubyonrails Rails=3.0.0-beta3
rubyonrails Rails=3.0.0-beta4
rubyonrails Rails=3.0.0-rc
rubyonrails Rails=3.0.0-rc2
rubyonrails Rails=3.0.1
rubyonrails Rails=3.0.1-pre
rubyonrails Rails=3.0.2
rubyonrails Rails=3.0.2-pre
rubyonrails Rails=3.0.3
rubyonrails Rails=3.0.4-rc1
rubyonrails Rails=3.0.5
rubyonrails Rails=3.0.5-rc1
rubyonrails Rails=3.0.6
rubyonrails Rails=3.0.6-rc1
rubyonrails Rails=3.0.6-rc2
rubyonrails Rails=3.0.7
rubyonrails Rails=3.0.7-rc1
rubyonrails Rails=3.0.7-rc2
rubyonrails Rails=3.0.8
rubyonrails Rails=3.0.8-rc1
rubyonrails Rails=3.0.8-rc2
rubyonrails Rails=3.0.8-rc3
rubyonrails Rails=3.0.8-rc4
rubyonrails Rails=3.0.9
rubyonrails Rails=3.0.9-rc1
rubyonrails Rails=3.0.9-rc2
rubyonrails Rails=3.0.9-rc3
rubyonrails Rails=3.0.9-rc4
rubyonrails Rails=3.0.9-rc5
rubyonrails Rails=3.0.10
rubyonrails Rails=3.0.10-rc1
rubyonrails Rails=3.0.11
rubyonrails Rails=3.0.12
rubyonrails Rails=3.0.12-rc1
rubyonrails Rails=3.0.13
rubyonrails Rails=3.0.13-rc1
rubyonrails Rails=3.0.14
rubyonrails Rails=3.0.16
rubyonrails Rails=3.0.17
rubyonrails Rails=3.0.18
rubyonrails Rails=3.0.19
rubyonrails ruby on Rails=3.0.4

Event History

Jan 24, 2013
Data Sourced
01:48 AM
DescriptionSeverityAffected Software
Jan 30, 2013
CVE Published
via MITRE·11:00 AM
Data Sourced
via MITRE·11:00 AM
Description
Oct 24, 2017
Advisory Published
06:33 PM

Frequently Asked Questions

1

What is the severity of CVE-2013-0333?

CVE-2013-0333 is considered a critical vulnerability due to the potential for remote code execution and other exploitations.

2

How do I fix CVE-2013-0333?

To fix CVE-2013-0333, upgrade ActiveSupport to version 2.3.16 or 3.0.20 or later.

3

What versions are affected by CVE-2013-0333?

CVE-2013-0333 affects Ruby on Rails versions 2.3.x before 2.3.16 and 3.0.x before 3.0.20.

4

What type of attacks can CVE-2013-0333 allow?

CVE-2013-0333 can potentially allow remote code execution, SQL injection attacks, and authentication bypass.

5

Is there a workaround for CVE-2013-0333?

There is no effective workaround for CVE-2013-0333, so upgrading to a patched version is essential.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203