Critical Code Injection Vulnerability in Ruby Package

ruby Updated 02 Oct 2025

Summary

26/11/2019
N/A
Yes i
High
8.1

ALPINE-CVE-2019-16255: Ruby through 2.4.7, 2.5.x through 2.5.6, and 2.6.x through 2.6.4 allows code injection if the first argument (aka the "command" argument) to Shell#[] or Shell#test in lib/shell.rb is untrusted data. Affects ruby versions < 2.5.7-r0. Fixed in 2.5.7-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 MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

Ruby is a dynamic, open-source programming language with a focus on simplicity and productivity. It is widely used for web development, particularly with the Ruby on Rails framework. The Ruby package provides essential libraries and tools for developers. However, certain versions of Ruby are vulnerable to a code injection issue that can be exploited if untrusted data is passed to specific shell commands.

Vulnerability Detail

The vulnerability, identified as CVE-2019-16255, affects Ruby versions through 2.4.7, 2.5.x through 2.5.6, and 2.6.x through 2.6.4. It allows for code injection when the first argument to Shell#[] or Shell#test in lib/shell.rb is untrusted data. An attacker can exploit this vulnerability to execute arbitrary Ruby methods, potentially leading to unauthorized access or manipulation of the system.

How To Fix

Minimum fixed version

2.5.7-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, avoid passing untrusted data to Shell#[] or Shell#test methods. Validate and sanitize any input before using it in these commands to mitigate the risk of code injection.

Conclusion

CVE-2019-16255 is a critical vulnerability in specific Ruby versions that can lead to code injection attacks. It is essential to update to the patched versions or implement workarounds to secure your applications. Regular monitoring for vulnerabilities using tools like Vulert can help maintain the security of your software.

See every vulnerability recorded for ruby →

Share this vulnerability

FAQ

CVE-2019-16255 is a vulnerability in Ruby that allows code injection through untrusted data passed to shell commands.

Ruby versions through 2.4.7, 2.5.x through 2.5.6, and 2.6.x through 2.6.4 are affected by this vulnerability.

You can use Vulert, which monitors open-source vulnerabilities in your software using a manifest file. Visit Vulert Scanner to check your application without signup.

The CVSS score for this vulnerability is 8.1, indicating a high severity level.

If immediate updates are not possible, ensure to validate and sanitize any input before using it in shell commands to reduce the risk of exploitation.

Related vulnerabilities

Recent vulnerabilities recorded for ruby.

How To Fix

Minimum fixed version

2.5.7-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