Bug 1002364 (CVE-2013-4287) - CVE-2013-4287 rubygems: version regex algorithmic complexity vulnerability
Summary: CVE-2013-4287 rubygems: version regex algorithmic complexity vulnerability
Keywords:
Status: CLOSED ERRATA
Alias: CVE-2013-4287
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1002838 1002839 1002841 1002842 1002843 1002844 1002845 1002847 1002848 1005269 1006429 1006440 1012267 1012780 1012789 1061934 1159439
Blocks: 1002366 1034635
TreeView+ depends on / blocked
 
Reported: 2013-08-29 03:20 UTC by Vincent Danen
Modified: 2023-05-11 23:57 UTC (History)
53 users (show)

Fixed In Version: rubygems 2.1.0, rubygems 2.0.8, rubygems 1.8.26, rubygems 1.8.23.1
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-01-21 07:51:40 UTC
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2013:1427 0 normal SHIPPED_LIVE Moderate: ruby193-ruby security update 2013-10-15 22:23:06 UTC
Red Hat Product Errata RHSA-2013:1441 0 normal SHIPPED_LIVE Moderate: rubygems security update 2013-10-17 21:18:53 UTC
Red Hat Product Errata RHSA-2013:1523 0 normal SHIPPED_LIVE Moderate: ruby193-ruby security update 2013-11-14 22:29:06 UTC
Red Hat Product Errata RHSA-2013:1852 0 normal SHIPPED_LIVE Moderate: Red Hat Enterprise MRG Grid 2.4 security update 2013-12-17 23:36:36 UTC
Red Hat Product Errata RHSA-2014:0207 0 normal SHIPPED_LIVE Moderate: rubygems security update 2014-02-24 22:56:55 UTC

Description Vincent Danen 2013-08-29 03:20:40 UTC
RubyGems validates versions with a regular expression that is vulnerable to
denial of service due to a backtracking regular expression.  For specially
crafted RubyGems versions attackers can cause denial of service through CPU
consumption.

RubyGems versions 2.0.7 and older, 2.1.0.rc.1 and 2.1.0.rc.2 are vulnerable.

Ruby versions 1.9.0 through 2.0.0p247 are vulnerable as they contain embedded
versions of RubyGems.

It does not appear to be possible to exploit this vulnerability by installing a
gem for RubyGems 1.8.x or 2.0.x.  Vulnerable uses of RubyGems API include
packaging a gem (through `gem build`, Gem::Package or Gem::PackageTask),
sending user input to Gem::Version.new, Gem::Version.correct? or use of the
Gem::Version::VERSION_PATTERN or Gem::Version::ANCHORED_VERSION_PATTERN
constants.

The vulnerability can be fixed by changing the first grouping to an atomic
grouping in Gem::Version::VERSION_PATTERN.  For RubyGems 2.0.x:

-  VERSION_PATTERN = '[0-9]+(\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:
+  VERSION_PATTERN = '[0-9]+(?>\.[0-9a-zA-Z]+)*(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?' # :nodoc:


Acknowledgements:

Red Hat would like to thank Rubygems upstream for reporting this vulnerability. Upstream acknowledges Damir Sharipov as the original reporter.

Comment 9 Tomas Hoger 2013-09-10 08:33:57 UTC
Fixed in: RubyGems 2.1.0, 2.0.8, 1.8.26 and 1.8.23.1

External references:

http://blog.rubygems.org/2013/09/09/CVE-2013-4287.html

Comment 10 Tomas Hoger 2013-09-10 08:36:45 UTC
Patch links from the upstream announcement:

- patch for RubyGems 2.1.0.rc.2, released as RubyGems 2.1.0:
https://github.com/rubygems/rubygems/commit/938a7e31ac73655845ab9045629ff3f580a125da

- patch for RubyGems 2.0.7, released as RubyGems 2.0.8:
https://github.com/rubygems/rubygems/commit/b9baec03145aed684d1cd3c87dcac3cc06becd9b

- patch for RubyGems 1.8.25, released as RubyGems 1.8.26:
https://github.com/rubygems/rubygems/commit/ed733bc379d75620f5be4213f89d1d7b38be3191

- patch for RubyGems 1.8.23, released as RubyGems 1.8.23.1:
https://github.com/rubygems/rubygems/commit/b697536f2455e8c8853cf5cf8a1017a36031ed67

Comment 13 Tomas Hoger 2013-09-16 08:17:00 UTC
There is an indication that upstream fix does not correctly fix all cases:

http://thread.gmane.org/gmane.comp.security.oss.general/11085/focus=11114

Comment 14 Tomas Hoger 2013-09-18 09:14:02 UTC
Upstream update addressing additional concerns is expected early next week:

http://thread.gmane.org/gmane.comp.security.oss.general/11085/focus=11130

Comment 16 Tomas Hoger 2013-09-25 07:58:32 UTC
(In reply to Tomas Hoger from comment #14)
> Upstream update addressing additional concerns is expected early next week:
> 
> http://thread.gmane.org/gmane.comp.security.oss.general/11085/focus=11130

Upstream update is now available, see bug 1009720, comment 1.

Comment 20 errata-xmlrpc 2013-10-15 18:24:25 UTC
This issue has been addressed in following products:

  Red Hat Software Collections for RHEL-6

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

Comment 21 errata-xmlrpc 2013-10-17 17:20:36 UTC
This issue has been addressed in following products:

  Red Hat Enterprise Linux 6

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

Comment 23 errata-xmlrpc 2013-11-14 17:30:53 UTC
This issue has been addressed in following products:

  OpenStack 3 for RHEL 6

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

Comment 24 errata-xmlrpc 2013-12-17 18:39:16 UTC
This issue has been addressed in following products:

  MRG for RHEL-6 v.2

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

Comment 28 errata-xmlrpc 2014-02-24 17:57:35 UTC
This issue has been addressed in following products:

  RHEL 6 Version of OpenShift Enterprise 2.0

Via RHSA-2014:0207 https://rhn.redhat.com/errata/RHSA-2014-0207.html

Comment 29 Kurt Seifried 2014-06-25 07:51:35 UTC
Statement:

Red Hat OpenShift Enterprise 1.2 is now in Production 1 Phase of the support
and maintenance life cycle. This has been rated as having Moderate security
impact and is not currently planned to be addressed in future updates. For
additional information, refer to the Red Hat OpenShift Enterprise Life Cycle:
https://access.redhat.com/site/support/policy/updates/openshift.

Comment 31 Kurt Seifried 2014-09-18 20:34:29 UTC
SAM-1 uses rubygems as a dependency and does not directly download or install additional ruby gems once installed.


Note You need to log in before you can comment on or make changes to this bug.