Bug 909029 (CVE-2013-0269)

Summary: CVE-2013-0269 rubygem-json: Denial of Service and SQL Injection
Product: [Other] Security Response Reporter: Kurt Seifried <kseifried>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: aneelica, bhu, bkabrda, bkearney, bleanhar, ccoleman, clalancette, cpelland, dajohnso, djorm, dmcphers, esammons, iboverma, jbpapp-maint, jeckersb, jeremy, jialiu, jlieskov, jneedle, jomara, jross, jstribny, katello-bugs, katello-internal, lmeyer, lxtnow, mastahnke, matt, mcressma, mfojtik, mgoldman, mjc, mmccune, mmorsi, morazi, mrg-program-list, msuchy, mtasaka, nwallace, rcvalle, sclewis, security-response-team, soa-p-jira, tagoh, tcunning, tdawson, tkramer, vanmeeuwen+fedora, vondruch, weli, williams
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard: impact=moderate,public=20130211,reported=20130207,source=upstream,cvss2=7.5/AV:N/AC:L/Au:N/C:P/I:P/A:P,cwe=CWE-502,cloudformscommon-1/rubygem-json=wontfix,sam-1/rubygem-json=affected,openshift-enterprise-1/ruby193-ruby=affected,openshift-enterprise-1/rubygem-json=affected,openshift-1/rubygem-json=affected,openshift-1/ruby193-rubygem-json=affected,mrg-2/rubygem-json=affected,fedora-all/rubygem-json=affected,fedora-all/ruby=affected,epel-all/rubygem-json=affected,fedora-rawhide/jruby=affected,jboss/fuse-entesb-7=affected,jboss/fuse-6=affected,jboss/dsp-5.3.0=wontfix,soap-4.3/jruby=wontfix,soap-5/jruby=affected,jboss/others=notaffected
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-09-03 00:56:26 EDT Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On: 910315, 909031, 909033, 909035, 909036, 910313, 910314, 974094, 978171, 995670    
Bug Blocks: 910299, 925673, 958335, 978151, 980652, 981152    
Description Flags
Updated patch for 1.7 version none

Description Kurt Seifried 2013-02-08 00:19:00 EST
Aaron Patterson of Ruby on Rails project reports:

Denial of Service and Unsafe Object Creation Vulnerability in JSON

There is a denial of service and unsafe object creation vulnerability in the 
json gem. This vulnerability has been assigned the CVE identifier 

Versions Affected:  All. This includes JSON that ships with Ruby 1.9.X-pXXX
Not affected:       NONE
Fixed Versions:     1.7.7, 1.6.8, 1.5.5

When parsing certain JSON documents, the JSON gem can be coerced in to 
creating Ruby symbols in a target system.  Since Ruby symbols are not garbage 
collected, this can result in a denial of service attack.

The same technique can be used to create objects in a target system that act 
like internal objects.  These "act alike" objects can be used to bypass 
certain security mechanisms and can be used as a spring board for SQL injection
attacks in Ruby on Rails.

Impacted code looks like this:


Where the `user_input` variable will have a JSON document like this:


The JSON gem will attempt to look up the constant "foo".  Looking up this 
constant will create a symbol.

In JSON version 1.7.x, objects with arbitrary attributes can be created using 
JSON documents like this:


This document will result in an instance of JSON::GenericObject, with the 
attribute "foo" that has the value "bar".  Instantiating these objects will 
result in arbitrary symbol creation and in some cases can be used to bypass 
security measures.

PLEASE NOTE: this behavior *does not change* when using `JSON.load`.  
`JSON.load` should *never* be given input from unknown sources.  If you are 
processing JSON from an unknown source, *always* use `JSON.parse`.

All users running an affected release should either upgrade or use one of the 
work arounds immediately. 

The FIXED releases are available at the normal locations.

For users that cannot upgrade, please use the attached patches.  If you cannot 
use the attached patches, change your code from this:


To this:

    JSON.parse(json, :create_additions => false)

If you cannot change the usage of `JSON.parse` (for example you're using a gem 
which depends on `JSON.parse` like multi_json), then apply this monkey patch:

    module JSON
      class << self
        alias :old_parse :parse
        def parse(json, args = {})
          args[:create_additions] = false
          old_parse(json, args)

To aid users who aren't able to upgrade immediately we have provided patches 
for the three supported release series.  They are in git-am format and consist 
of a single changeset. 

* 1-7-VULN.patch - Patch for the 1.7 series
* 1-6-VULN.patch - Patch for the 1.6 series
* 1-5-VULN.patch - Patch for the 1.5 series

* Thomas Hollstegge of Zweitag (www.zweitag.de)
* Ben Murphy
Comment 1 Kurt Seifried 2013-02-08 00:20:35 EST
Created attachment 694933 [details]
Comment 2 Kurt Seifried 2013-02-08 00:20:56 EST
Created attachment 694934 [details]
Comment 3 Kurt Seifried 2013-02-08 00:21:16 EST
Created attachment 694936 [details]
Comment 12 Tomas Hoger 2013-02-12 05:03:28 EST
Created ruby tracking bugs for this issue

Affects: fedora-all [bug 910314]
Comment 13 Tomas Hoger 2013-02-12 05:03:33 EST
Created rubygem-json tracking bugs for this issue

Affects: fedora-all [bug 910313]
Affects: epel-all [bug 910315]
Comment 14 Jan Lieskovsky 2013-02-12 05:16:30 EST
Created attachment 696457 [details]
Updated patch for 1.7 version

Updated patch for 1.7 version from:
  [1] http://www.openwall.com/lists/oss-security/2013/02/11/8

From [1]:

I've attached an updated patch for the JSON gem.  This patch is for the
1.7.x series.  The difference in this patch is changing the version

Aaron Patterson
Comment 18 Vincent Danen 2013-02-22 10:27:33 EST
External References:

Comment 19 errata-xmlrpc 2013-03-26 15:17:59 EDT
This issue has been addressed in following products:

  Red Hat Subscription Asset Manager 1.2

Via RHSA-2013:0686 https://rhn.redhat.com/errata/RHSA-2013-0686.html
Comment 20 Murray McAllister 2013-03-27 06:13:16 EDT

Red Hat would like to thank Ruby on Rails upstream for reporting this issue. Upstream acknowledges Thomas Hollstegge of Zweitag and Ben Murphy as the original reporters.
Comment 22 errata-xmlrpc 2013-04-02 16:07:10 EDT
This issue has been addressed in following products:

  RHEL 6 Version of OpenShift Enterprise

Via RHSA-2013:0701 https://rhn.redhat.com/errata/RHSA-2013-0701.html
Comment 27 errata-xmlrpc 2013-07-09 13:37:14 EDT
This issue has been addressed in following products:

  Fuse ESB Enterprise 7.1.0

Via RHSA-2013:1028 https://rhn.redhat.com/errata/RHSA-2013-1028.html
Comment 28 Kurt Seifried 2013-07-26 02:21:42 EDT
The Red Hat Security Response Team has rated this issue as having moderate security impact in CloudForms 1.1. This issue is not currently planned to be addressed in future updates.
Comment 29 errata-xmlrpc 2013-08-08 13:08:54 EDT
This issue has been addressed in following products:

  Red Hat JBoss SOA Platform 5.3.1

Via RHSA-2013:1147 https://rhn.redhat.com/errata/RHSA-2013-1147.html
Comment 31 errata-xmlrpc 2013-08-29 19:28:40 EDT
This issue has been addressed in following products:

  Red Hat JBoss Fuse 6.0.0

Via RHSA-2013:1185 https://rhn.redhat.com/errata/RHSA-2013-1185.html