ruby-debug / ruby-debug-ide

An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine.
https://www.jetbrains.com/ruby/features/ruby_debugger.html
Other
370 stars 83 forks source link

Ruby Remote Debug Can Cause Arbitrary Remote Code Execution #220

Open GeekOnlineCode opened 2 years ago

GeekOnlineCode commented 2 years ago

When you use ruby-debug-ide for remote debugging,it will potentially cause arbitrary remote code execution. rdebug-ide --host 0.0.0.0 --port 6666 --dispatcher-port 6666 -- test.rb s telnet remote_host remote_port Because there is no permission verification, as long as the port is opened, everyone can access remotely.Other language debugger there was a similar situation,like Node.js Debug RCE(https://www.cvedetails.com/cve/CVE-2018-12120/) 、Java Debug RCE(https://www.rapid7.com/db/modules/exploit/multi/misc/java_jdwp_debugger/).

Remote code execution can be exploited through the following steps.

1.Although the help document without any command execution instructions(https://github.com/ruby-debug/ruby-debug-ide/blob/master/protocol-spec.md). Looks can't remote command execution. image 2.But I found in the directory(ruby-debug-ide/lib/ruby-debug-ide/commands/) that command eval can execute arbitrary commands. image

image 3.So when anybody connected the remote service who can execute arbitrary code execution. image

Advice

1.Modify the readme.md content,using a specific IP --host specific_ip image 2.Delete the "eval" command 3.Using the authentication like SSH.