CVE-2019-16255: A code injection vulnerability of Shell#[] and Shell#test

A code injection vulnerability of Shell#[] and Shell#test in a standard library (lib/shell.rb) was found. The vulnerability has been assigned the CVE identifier CVE-2019-16255.


Shell#[] and its alias Shell#test defined in lib/shell.rb allow code injection if the first argument (aka the “command” argument) is untrusted data. An attacker can exploit this to call an arbitrary Ruby method.

Note that passing untrusted data to methods of Shell is dangerous in general. Users must never do it. However, we treat this particular case as a vulnerability because the purpose of Shell#[] and Shell#test is considered file testing.

All users running an affected release should upgrade immediately.

Affected Versions

  • All releases that are Ruby 2.3 or earlier
  • Ruby 2.4 series: Ruby 2.4.7 or earlier
  • Ruby 2.5 series: Ruby 2.5.6 or earlier
  • Ruby 2.6 series: Ruby 2.6.4 or earlier
  • Ruby 2.7.0-preview1


Thanks to ooooooo_q for discovering this issue.


  • Originally published at 2019-10-01 11:00:00 (UTC)
  • Fixed minor spelling problem at 2019-10-05 12:00:00 (UTC)