Critical Vulnerability in Ruby Package: Malicious Gem Specifications Execution Risk

ruby Updated 02 Oct 2025

Summary

31/08/2017
N/A
Yes i
Critical
9.8

ALPINE-CVE-2017-0899: RubyGems version 2.6.12 and earlier is vulnerable to maliciously crafted gem specifications that include terminal escape characters. Affects ruby versions < 2.4.2-r0. Fixed in 2.4.2-r0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

Ruby is a dynamic, open-source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. RubyGems is a package manager for Ruby that provides a standard format for distributing Ruby programs and libraries. However, versions of RubyGems prior to 2.6.12 are susceptible to a vulnerability that allows maliciously crafted gem specifications to execute terminal escape sequences, posing a significant security risk.

Vulnerability Detail

The vulnerability, identified as CVE-2017-0899, originates from RubyGems versions 2.6.12 and earlier. It allows attackers to create gem specifications that include terminal escape characters. When these specifications are printed, they can execute unintended terminal escape sequences, potentially leading to arbitrary code execution or other malicious actions. This vulnerability has a CVSS score of 9.8, indicating its critical nature and the severe impact it can have on affected systems.

How To Fix

Minimum fixed version

2.4.2-r0

This is the first release that contains the fix.

sudo apk add --upgrade ruby

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can avoid executing gem specifications from untrusted sources. Additionally, ensure that your terminal environment is configured to handle escape sequences safely, although this may not fully mitigate the risk.

Conclusion

The vulnerability CVE-2017-0899 in RubyGems poses a critical risk due to its ability to execute malicious terminal escape sequences through crafted gem specifications. It is crucial for users to update to the latest version of RubyGems to mitigate this risk. Regular monitoring and adherence to security best practices are essential to safeguard applications from such vulnerabilities.

See every vulnerability recorded for ruby →

Share this vulnerability

FAQ

CVE-2017-0899 is a vulnerability in RubyGems that allows malicious gem specifications to execute terminal escape sequences, potentially leading to arbitrary code execution.

You can check your RubyGems version by running the command gem -v in your terminal. If it is 2.6.12 or earlier, it is affected.

If immediate updates are not possible, avoid using gem specifications from untrusted sources and ensure your terminal is configured to handle escape sequences safely.

If your application uses an affected version of RubyGems, it may be at risk of executing malicious code through crafted gem specifications, leading to potential data breaches or system compromise.

Yes, Vulert can monitor and alert you in real-time for open-source vulnerabilities in your software using just a manifest file like package-lock.json. You can check if your application is affected by this vulnerability using the Vulert playground without any signup.

Related vulnerabilities

Recent vulnerabilities recorded for ruby.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

2.4.2-r0

This is the first release that contains the fix.

sudo apk add --upgrade ruby

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback