CVE-2013-4287: Medium severity redhat Enterprise Linux vulnerability
Algorithmic complexity vulnerability in Gem::Version::VERSIONPATTERN in lib/rubygems/version.rb in RubyGems before 1.8.23.1, 1.8.24 through 1.8.25, 2.0.x before 2.0.8, and 2.1.x before 2.1.0, as used in Ruby 1.9.0 through 2.0.0p247, allows remote attackers to cause a denial of service (CPU consumption) via a crafted gem version that triggers a large amount of backtracking in a regular expression.
Other sources
Algorithmic complexity vulnerability in Gem::Version::VERSIONPATTERN in lib/rubygems/version.rb in RubyGems before 1.8.23.1, 1.8.24 through 1.8.25, 2.0.x before 2.0.8, and 2.1.x before 2.1.0, as used in Ruby 1.9.0 through 2.0.0p247, allows remote attackers to cause a denial of service (CPU consumption) via a crafted gem version that triggers a large amount of backtracking in a regular expression.
— MITRE
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::VERSIONPATTERN or Gem::Version::ANCHOREDVERSIONPATTERN constants.
The vulnerability can be fixed by changing the first grouping to an atomic grouping in Gem::Version::VERSIONPATTERN. For RubyGems 2.0.x:
- VERSIONPATTERN = '[0-9]+(\.[0-9a-zA-Z]+)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+))?' # :nodoc: + VERSIONPATTERN = '[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.
— Red Hat
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
rubygems/rubygems-updateto a version that resolves this vulnerability.Fixed in 2.1.0 - Upgrade
Upgrade
rubygems/rubygems-updateto a version that resolves this vulnerability.Fixed in 2.0.8 - Upgrade
Upgrade
rubygems/rubygems-updateto a version that resolves this vulnerability.Fixed in 1.8.26 - Upgrade
Upgrade
rubygems/rubygems-updateto a version that resolves this vulnerability.Fixed in 1.8.23.1 - Upgrade
Upgrade
redhat/rubygemsto a version that resolves this vulnerability.Fixed in 2.1.0 - Upgrade
Upgrade
redhat/rubygemsto a version that resolves this vulnerability.Fixed in 2.0.8 - Upgrade
Upgrade
redhat/rubygemsto a version that resolves this vulnerability.Fixed in 1.8.26 - Upgrade
Upgrade
redhat/rubygemsto a version that resolves this vulnerability.Fixed in 1.8.23.1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 1.8.23.1 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.0.8 - Upgrade
Upgrade to a fixed release to a version that resolves this vulnerability.
Fixed in 2.1.0
Event History
Frequently Asked Questions
What is the severity of CVE-2013-4287?
CVE-2013-4287 is considered to have a medium severity as it allows remote attackers to cause a denial of service.
How do I fix CVE-2013-4287?
To fix CVE-2013-4287, update RubyGems to versions 1.8.26, 1.8.23.1, 2.0.8, or 2.1.0.
Which versions of RubyGems are affected by CVE-2013-4287?
Versions of RubyGems prior to 1.8.23.1, 1.8.24 through 1.8.25, 2.0.x before 2.0.8, and 2.1.x before 2.1.0 are affected.
What type of vulnerability is CVE-2013-4287?
CVE-2013-4287 is an algorithmic complexity vulnerability affecting the version handling in RubyGems.
Are Ruby versions also affected by CVE-2013-4287?
Yes, Ruby versions from 1.9.0 through 2.0.0p247 can be affected when using vulnerable RubyGems.