Merge pull request #1128 from voxik/patch-1
[rubygems] / CVE-2013-4363.txt
1 = Algorithmic complexity vulnerability in RubyGems 2.1.4 and older
2
3 The patch for CVE-2013-4287 was insufficiently verified so the combined
4 regular expression for verifying gem version remains vulnerable following
5 CVE-2013-4287.
6
7 RubyGems validates versions with a regular expression that is vulnerable to
8 denial of service due to backtracking.  For specially crafted RubyGems
9 versions attackers can cause denial of service through CPU consumption.
10
11 RubyGems versions 2.1.4 and older are vulnerable.
12
13 Ruby versions 1.9.0 through 2.0.0p247 are vulnerable as they contain embedded
14 versions of RubyGems.
15
16 It does not appear to be possible to exploit this vulnerability by installing a
17 gem for RubyGems 1.8.x or newer.  Vulnerable uses of RubyGems API include
18 packaging a gem (through `gem build`, Gem::Package or Gem::PackageTask),
19 sending user input to Gem::Version.new, Gem::Version.correct? or use of the
20 Gem::Version::VERSION_PATTERN or Gem::Version::ANCHORED_VERSION_PATTERN
21 constants.
22
23 Notably, users of bundler that install gems from git are vulnerable if a
24 malicious author changes the gemspec to an invalid version.
25
26 The vulnerability can be fixed by changing the "*" repetition to a "?"
27 repetition in Gem::Version::ANCHORED_VERSION_PATTERN in
28 lib/rubygems/version.rb.  For RubyGems 2.1.x:
29
30   -  ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\z/ # :nodoc:
31   +  ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
32
33 For RubyGems 2.0.x:
34
35   -  ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\z/ # :nodoc:
36   +  ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
37
38 For RubyGems 1.8.x:
39
40   -  ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})*\s*\z/ # :nodoc:
41   +  ANCHORED_VERSION_PATTERN = /\A\s*(#{VERSION_PATTERN})?\s*\z/ # :nodoc:
42
43
44 This vulnerability was discovered by Alexander Cherepanov <cherepan@mccme.ru>
45