# CVE-2013-4287: RubyGems Regular Expression Denial of Service vulnerability

> Remote attackers can cause denial of service via CPU exhaustion by submitting crafted gem versions that trigger excessive regex backtracking in RubyGems.

- **Severity:** Medium 4.3 (`AV:N/AC:M/Au:N/C:N/I:N/A:P`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 17 Oct 2013
- **Updated:** 6 Aug 2024
- **Also known as:** DEBIAN-CVE-2013-4287, GHSA-9j7m-rjqx-48vh, RHSA-2013:1427, RHSA-2013:1523, RHSA-2014:0207

## What is CVE-2013-4287?

CVE-2013-4287 is a medium-severity denial of service vulnerability in Redhat Enterprise Linux, published on 17 Oct 2013. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

Algorithmic complexity vulnerability in Gem::Version::VERSION_PATTERN 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.

Weakness: CWE-310

## Which versions are affected by CVE-2013-4287?

8 open source packages ship an affected version, including rubygems-update. It affects 3 products.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `rubygems-update` | RubyGems | All versions | 1.8.23.1 |
| `rubygems-update` | RubyGems | All versions | 1.8.23.1 |
| `rubygems-update` | RubyGems | From 1.8.24 | 1.8.26 |
| `rubygems-update` | RubyGems | From 1.8.24 | 1.8.26 |
| `rubygems-update` | RubyGems | From 2.0.0 | 2.0.8 |
| `rubygems-update` | RubyGems | From 2.0.0 | 2.0.8 |
| `rubygems-update` | RubyGems | From 2.1.0.rc.1 | 2.1.0 |
| `rubygems-update` | RubyGems | From 2.1.0.rc.1 | 2.1.0 |
| `rubygems` | Red Hat:openshift:2.0::el6 | All versions | 0:1.8.24-5.el6op |
| `rubygems-devel` | Red Hat:openshift:2.0::el6 | All versions | 0:1.8.24-5.el6op |
| `ruby193-ruby` | Red Hat:openstack:3::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-debuginfo` | Red Hat:openstack:3::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-devel` | Red Hat:openstack:3::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-doc` | Red Hat:openstack:3::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-irb` | Red Hat:openstack:3::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-libs` | Red Hat:openstack:3::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-tcltk` | Red Hat:openstack:3::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-rubygem-bigdecimal` | Red Hat:openstack:3::el6 | All versions | 0:1.1.0-40.el6 |
| `ruby193-rubygem-io-console` | Red Hat:openstack:3::el6 | All versions | 0:0.3-40.el6 |
| `ruby193-rubygem-json` | Red Hat:openstack:3::el6 | All versions | 0:1.5.5-40.el6 |
| `ruby193-rubygem-minitest` | Red Hat:openstack:3::el6 | All versions | 0:2.5.1-40.el6 |
| `ruby193-rubygem-rake` | Red Hat:openstack:3::el6 | All versions | 0:0.9.2.2-40.el6 |
| `ruby193-rubygems` | Red Hat:openstack:3::el6 | All versions | 0:1.8.24-9.el6ost |
| `ruby193-rubygems-devel` | Red Hat:openstack:3::el6 | All versions | 0:1.8.24-9.el6ost |
| `ruby193-ruby` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-debuginfo` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-devel` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-doc` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-irb` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-libs` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-ruby-tcltk` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.9.3.448-40.el6 |
| `ruby193-rubygem-bigdecimal` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.1.0-40.el6 |
| `ruby193-rubygem-io-console` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:0.3-40.el6 |
| `ruby193-rubygem-json` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.5.5-40.el6 |
| `ruby193-rubygem-minitest` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:2.5.1-40.el6 |
| `ruby193-rubygem-rake` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:0.9.2.2-40.el6 |
| `ruby193-rubygem-rdoc` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:3.9.5-40.el6 |
| `ruby193-rubygems` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.8.23-40.el6 |
| `ruby193-rubygems-devel` | Red Hat:rhel_software_collections:1::el6 | All versions | 0:1.8.23-40.el6 |

Products: Redhat Enterprise Linux, Ruby-Lang Ruby, Rubygems Rubygems.

## How do I fix CVE-2013-4287?

Upgrade rubygems-update to a fixed version for your release line: 1.8.23.1, 1.8.26, 2.0.8 or 2.1.0.

## Is CVE-2013-4287 being exploited?

There is no known exploitation of CVE-2013-4287 in the wild and no public exploit code.

## Other vulnerabilities in Redhat Enterprise Linux

- [CVE-2018-14667](https://insights.sbomify.com/CVE-2018-14667/): Red Hat JBoss RichFaces Framework Expression Language Injection (critical 9.8, exploited in the wild)
- [CVE-2021-20325](https://insights.sbomify.com/CVE-2021-20325/): Missing fixes for CVE-2021-40438 and CVE-2021-26691 in the versions of httpd, as shipped in Red Hat Enterprise Linux 8.5.0, causes a securit (critical 9.8)
- [CVE-2018-25011](https://insights.sbomify.com/CVE-2018-25011/): Memory corruption in libwebp (critical 9.8)
- [CVE-2018-25014](https://insights.sbomify.com/CVE-2018-25014/): Other in libwebp (critical 9.8)
- [CVE-2014-3585](https://insights.sbomify.com/CVE-2014-3585/): Supply chain in redhat-upgrade-tool (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2013-4287 and fix it if it is affected.

What it is: CVE-2013-4287 is a medium-severity denial of service vulnerability in Redhat Enterprise Linux, published on 17 Oct 2013. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2013-4287 in the wild and no public exploit code.

Affected packages and fixed versions:
- rubygems-update (RubyGems): affected all versions; fixed in 1.8.23.1
- rubygems-update (RubyGems): affected all versions; fixed in 1.8.23.1
- rubygems-update (RubyGems): affected from 1.8.24; fixed in 1.8.26
- rubygems-update (RubyGems): affected from 1.8.24; fixed in 1.8.26
- rubygems-update (RubyGems): affected from 2.0.0; fixed in 2.0.8
- rubygems-update (RubyGems): affected from 2.0.0; fixed in 2.0.8
- rubygems-update (RubyGems): affected from 2.1.0.rc.1; fixed in 2.1.0
- rubygems-update (RubyGems): affected from 2.1.0.rc.1; fixed in 2.1.0

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2013-4287/ (Markdown: https://insights.sbomify.com/CVE-2013-4287/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2013-4287
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2013-4287
- OSV: https://osv.dev/vulnerability/CVE-2013-4287

---
From sbomify Insights: https://insights.sbomify.com/CVE-2013-4287/
Summaries are generated and may contain mistakes; the official description above is the record.
