more httpClient modules use store_valid_credential

bug/bundler_fix
Jeffrey Martin 2017-05-30 14:43:53 -05:00
parent 0c792798a7
commit 0e145573fc
No known key found for this signature in database
GPG Key ID: 0CD9BBC2AF15F171
17 changed files with 64 additions and 532 deletions

View File

@ -293,37 +293,10 @@ class MetasploitModule < Msf::Exploit::Remote
return nil return nil
end end
def report_cred(opts)
service_data = {
address: rhost,
port: rport,
service_name: ssl ? 'https' : 'http',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: fullname,
post_reference_name: self.refname,
private_data: opts[:password],
origin_type: :service,
private_type: :password,
username: opts[:user]
}.merge(service_data)
login_data = {
core: create_credential(credential_data),
status: Metasploit::Model::Login::Status::SUCCESSFUL,
last_attempted_at: Time.now
}.merge(service_data)
create_credential_login(login_data)
end
def exploit def exploit
# login if needed # login if needed
if (not datastore['USERNAME'].empty? and not datastore['PASSWORD'].empty?) if (not datastore['USERNAME'].empty? and not datastore['PASSWORD'].empty?)
report_cred(user: datastore['USERNAME'], password: datastore['PASSWORD']) store_valid_credential(user: datastore['USERNAME'], private: datastore['PASSWORD'])
student_cookie = login(datastore['USERNAME'], datastore['PASSWORD']) student_cookie = login(datastore['USERNAME'], datastore['PASSWORD'])
print_good("Logged in as #{datastore['USERNAME']}") print_good("Logged in as #{datastore['USERNAME']}")
# else, we reset the students password via a type juggle vulnerability # else, we reset the students password via a type juggle vulnerability
@ -352,6 +325,10 @@ class MetasploitModule < Msf::Exploit::Remote
end end
end end
def service_details
super.merge({ post_reference_name: self.refname })
end
=begin =begin
php.ini settings: php.ini settings:
display_errors = On display_errors = On

View File

@ -158,33 +158,6 @@ class MetasploitModule < Msf::Exploit::Remote
datastore['NEWSSHPASS'] || Rex::Text.rand_text_alpha(5) datastore['NEWSSHPASS'] || Rex::Text.rand_text_alpha(5)
end end
def report_cred(opts)
service_data = {
address: rhost,
port: rport,
service_name: 'cisco',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :service,
module_fullname: fullname,
username: opts[:user],
private_data: opts[:password],
private_type: :password
}.merge(service_data)
login_data = {
last_attempted_at: DateTime.now,
core: create_credential(credential_data),
status: Metasploit::Model::Login::Status::SUCCESSFUL,
proof: opts[:proof]
}.merge(service_data)
create_credential_login(login_data)
end
def do_login def do_login
console_user = datastore['USERNAME'] console_user = datastore['USERNAME']
console_pass = datastore['PASSWORD'] console_pass = datastore['PASSWORD']
@ -211,7 +184,7 @@ class MetasploitModule < Msf::Exploit::Remote
cgi_sid = res_cookie.scan(/CGISESSID=(\w+);/).flatten.first cgi_sid = res_cookie.scan(/CGISESSID=(\w+);/).flatten.first
print_status("CGI Session ID: #{cgi_sid}") print_status("CGI Session ID: #{cgi_sid}")
print_good("Authenticated as #{console_user}:#{console_pass}") print_good("Authenticated as #{console_user}:#{console_pass}")
report_cred(username: console_user, password: console_pass) store_valid_credential(user: console_user, private: console_pass) # changes service_name to http || https
return cgi_sid return cgi_sid
end end

View File

@ -71,33 +71,6 @@ class MetasploitModule < Msf::Exploit::Remote
]) ])
end end
def report_cred(opts)
service_data = {
address: opts[:ip],
port: opts[:port],
service_name: opts[:service_name],
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: fullname,
post_reference_name: self.refname,
private_data: opts[:password],
origin_type: :service,
private_type: :password,
username: opts[:user]
}.merge(service_data)
login_data = {
core: create_credential(credential_data),
status: Metasploit::Model::Login::Status::SUCCESSFUL,
last_attempted_at: opts[:attempt_time]
}.merge(service_data)
create_credential_login(login_data)
end
def check def check
return Exploit::CheckCode::Safe unless webcommand_exists? return Exploit::CheckCode::Safe unless webcommand_exists?
return Exploit::CheckCode::Safe if exploit_sqli(1, bad_char(0)) return Exploit::CheckCode::Safe if exploit_sqli(1, bad_char(0))
@ -119,14 +92,7 @@ class MetasploitModule < Msf::Exploit::Remote
@session = send_login @session = send_login
fail_with(Failure::NoAccess, "#{peer} - Login with admin/#{@password} failed...") if @session.nil? fail_with(Failure::NoAccess, "#{peer} - Login with admin/#{@password} failed...") if @session.nil?
report_cred( store_valid_credential(user: 'admin', private: @password)
ip: rhost,
port: rport,
user: 'admin',
service_name: 'http',
password: @password,
attempt_time: DateTime.now
)
print_status("Retrieving the server name...") print_status("Retrieving the server name...")
@server = server_info @server = server_info

View File

@ -156,50 +156,18 @@ class MetasploitModule < Msf::Exploit::Remote
'encode_params' => false, 'encode_params' => false,
'data' => post_data 'data' => post_data
}) })
sessid_cookie = (res.get_cookies || '').scan(/SESSID=(\w+);/).flatten[0] || ''
print_status("Saving login credentials into Metasploit DB")
report_cred(uname, passwd)
else else
print_status("Valid login credentials provided. Successfully logged in") print_status("Valid login credentials provided. Successfully logged in")
sessid_cookie = (res.get_cookies || '').scan(/SESSID=(\w+);/).flatten[0] || ''
print_status("Saving login credentials into Metasploit DB")
report_cred(uname, passwd)
end end
sessid_cookie = (res.get_cookies || '').scan(/SESSID=(\w+);/).flatten[0] || ''
print_status("Saving login credentials into Metasploit DB")
store_valid_credential(user: uname, private: passwd)
return sessid_cookie return sessid_cookie
end end
def report_cred(username, password)
# Function used to save login credentials into Metasploit database
service_data = {
address: rhost,
port: rport,
service_name: ssl ? 'https' : 'http',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: self.fullname,
origin_type: :service,
username: username,
private_data: password,
private_type: :password
}.merge(service_data)
credential_core = create_credential(credential_data)
login_data = {
core: credential_core,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
}.merge(service_data)
create_credential_login(login_data)
end
def create_user def create_user
# Function exploiting login SQLi to create a malicious user # Function exploiting login SQLi to create a malicious user
username = datastore['RIVERBED_USER'] username = datastore['RIVERBED_USER']

View File

@ -187,34 +187,6 @@ class MetasploitModule < Msf::Exploit::Remote
}) })
end end
def save_cred(username, password)
service_data = {
address: rhost,
port: rport,
service_name: protocol,
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: self.fullname,
origin_type: :service,
username: username,
private_data: password,
private_type: :password
}.merge(service_data)
credential_core = create_credential(credential_data)
login_data = {
core: credential_core,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
}.merge(service_data)
create_credential_login(login_data)
end
def exploit def exploit
print_status("Getting the PHPSESSID...") print_status("Getting the PHPSESSID...")
sid = get_sid sid = get_sid
@ -230,7 +202,7 @@ class MetasploitModule < Msf::Exploit::Remote
return return
else else
# Good password, keep it # Good password, keep it
save_cred(datastore['USERNAME'], datastore['PASSWORD']) store_valid_credential(user: datastore['USERNAME'], private: datastore['PASSWORD'])
end end
print_status("Trying restore.php...") print_status("Trying restore.php...")

View File

@ -89,7 +89,7 @@ class MetasploitModule < Msf::Exploit::Remote
fail_with(Failure::Unknown, "Could not connect to web service - invalid credentials (response code: #{res.code}") fail_with(Failure::Unknown, "Could not connect to web service - invalid credentials (response code: #{res.code}")
else else
print_good("Successful login #{user} : #{pass}") print_good("Successful login #{user} : #{pass}")
save_cred(user, pass) store_valid_credential(user: user, private: pass) # service_name becomes http || https, a conflicting service_details could occur in future. Telnet lib does not yet provide service_details.
end end
rescue ::Rex::ConnectionError rescue ::Rex::ConnectionError
fail_with(Failure::Unknown, "Could not connect to the web service") fail_with(Failure::Unknown, "Could not connect to the web service")
@ -172,32 +172,4 @@ class MetasploitModule < Msf::Exploit::Remote
return nil return nil
end end
end end
def save_cred(username, password)
service_data = {
address: rhost,
port: rport,
service_name: 'telnet',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: self.fullname,
origin_type: :service,
username: username,
private_data: password,
private_type: :password
}.merge(service_data)
credential_core = create_credential(credential_data)
login_data = {
core: credential_core,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
}.merge(service_data)
create_credential_login(login_data)
end
end end

View File

@ -154,46 +154,13 @@ class MetasploitModule < Msf::Exploit::Remote
sid = res.get_cookies.scan(/([^=]*)=[^;]*;/).last.first sid = res.get_cookies.scan(/([^=]*)=[^;]*;/).last.first
sid_value = res.get_cookies.scan(/#{sid}=([^;]*);/).last.first sid_value = res.get_cookies.scan(/#{sid}=([^;]*);/).last.first
end end
report_cred( store_valid_credential(user: datastore['ADMINACCOUNT'], private: datastore['ADMINPASS'], proof: "#{sid}=#{sid_value}")
ip: datastore['RHOST'],
port: datastore['RPORT'],
service_name: (ssl ? "https" : "http"),
user: datastore['ADMINACCOUNT'],
password: datastore['ADMINPASS'],
proof: "#{sid}=#{sid_value}"
)
return {"sid" => sid, "sid_value" => sid_value} return {"sid" => sid, "sid_value" => sid_value}
end end
end end
nil nil
end end
def report_cred(opts)
service_data = {
address: opts[:ip],
port: opts[:port],
service_name: opts[:service_name],
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :service,
module_fullname: fullname,
username: opts[:user],
private_data: opts[:password],
private_type: :password
}.merge(service_data)
login_data = {
core: create_credential(credential_data),
status: Metasploit::Model::Login::Status::SUCCESSFUL,
proof: opts[:proof]
}.merge(service_data)
create_credential_login(login_data)
end
def exploit def exploit
opts = login opts = login
if opts if opts

View File

@ -136,7 +136,7 @@ class MetasploitModule < Msf::Exploit::Remote
cookie = "ATutorID=#{$4};" if res.get_cookies =~ /ATutorID=(.*); ATutorID=(.*); ATutorID=(.*); ATutorID=(.*);/ cookie = "ATutorID=#{$4};" if res.get_cookies =~ /ATutorID=(.*); ATutorID=(.*); ATutorID=(.*); ATutorID=(.*);/
if res && res.code == 302 && res.redirection.to_s.include?('admin/index.php') if res && res.code == 302 && res.redirection.to_s.include?('admin/index.php')
# if we made it here, we are admin # if we made it here, we are admin
report_cred(user: username, password: hash) store_valid_credential(user: username, private: hash, private_type: :nonreplayable_hash)
return cookie return cookie
end end
# auth failed if we land here, bail # auth failed if we land here, bail
@ -227,32 +227,8 @@ class MetasploitModule < Msf::Exploit::Remote
return false return false
end end
def report_cred(opts) def service_details
service_data = { super.merge({ post_reference_name: self.refname, jtr_format: 'sha512' })
address: rhost,
port: rport,
service_name: ssl ? 'https' : 'http',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: fullname,
post_reference_name: self.refname,
private_data: opts[:password],
origin_type: :service,
private_type: :nonreplayable_hash,
jtr_format: 'sha512',
username: opts[:user]
}.merge(service_data)
login_data = {
core: create_credential(credential_data),
status: Metasploit::Model::Login::Status::SUCCESSFUL,
last_attempted_at: Time.now
}.merge(service_data)
create_credential_login(login_data)
end end
def exploit def exploit

View File

@ -718,35 +718,12 @@ class MetasploitModule < Msf::Exploit::Remote
end end
def my_target_host def my_target_host
my_target_host = "http://#{rhost.to_s}:#{rport.to_s}#{normalize_uri(target_uri.path)}" "http://#{rhost.to_s}:#{rport.to_s}#{normalize_uri(target_uri.path)}"
end end
def report_cred(opts) def service_details
service_data = { super.merge({ post_reference_name: self.refname })
address: rhost,
port: rport,
service_name: 'glassfish',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: fullname,
post_reference_name: self.refname,
private_data: opts[:password],
origin_type: :service,
private_type: :password,
username: opts[:user]
}.merge(service_data)
login_data = {
core: create_credential(credential_data),
status: Metasploit::Model::Login::Status::SUCCESSFUL,
last_attempted_at: DateTime.now
}.merge(service_data)
create_credential_login(login_data)
end end
def try_normal_login(version) def try_normal_login(version)
@ -783,7 +760,7 @@ class MetasploitModule < Msf::Exploit::Remote
print_status("Trying to login as #{cred.public}:#{cred.private}") print_status("Trying to login as #{cred.public}:#{cred.private}")
result = @scanner.attempt_login(cred) result = @scanner.attempt_login(cred)
if result.status == Metasploit::Model::Login::Status::SUCCESSFUL if result.status == Metasploit::Model::Login::Status::SUCCESSFUL
report_cred(user: cred.public, password: cred.private) store_valid_credential(user: cred.public, private: cred.private) # changes service_name to http || https
return @scanner.jsession return @scanner.jsession
end end
end end

View File

@ -193,38 +193,8 @@ class MetasploitModule < Msf::Exploit::Remote
end end
# Reports username and password to the database. def service_details
# super.merge({ post_reference_name: self.refname })
# @param opts [Hash]
# @option opts [String] :user
# @option opts [String] :password
#
# @return [void]
def report_cred(opts)
service_data = {
address: rhost,
port: rport,
service_name: ssl ? 'https' : 'http',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: fullname,
post_reference_name: self.refname,
private_data: opts[:password],
origin_type: :service,
private_type: :password,
username: opts[:user]
}.merge(service_data)
login_data = {
core: create_credential(credential_data),
status: Metasploit::Model::Login::Status::SUCCESSFUL,
last_attempted_at: Time.now
}.merge(service_data)
create_credential_login(login_data)
end end
@ -269,10 +239,7 @@ class MetasploitModule < Msf::Exploit::Remote
fail_with(Failure::NoAccess, 'Incorrect username or password') fail_with(Failure::NoAccess, 'Incorrect username or password')
end end
report_cred( store_valid_credential(user: jira_username, private: jira_password, proof: cookie) # expands to store cookie
user: jira_username,
password: jira_password
)
cookie cookie
end end

View File

@ -179,47 +179,12 @@ class MetasploitModule < Msf::Exploit::Remote
elsif res['loginfailed'] elsif res['loginfailed']
fail_with(Failure::NoAccess, "Password '#{datastore['PASSWORD']}' is incorrect.") fail_with(Failure::NoAccess, "Password '#{datastore['PASSWORD']}' is incorrect.")
elsif res['sessionid'] elsif res['sessionid']
report_cred(datastore['USERNAME'], datastore['PASSWORD']) store_valid_credential(user: datastore['USERNAME'], private: datastore['PASSWORD'])
end end
res res
end end
# Saves a valid username/password to database.
#
# @param username [String]
# @param password [String]
# @return [void]
def report_cred(username, password)
service_data = {
address: rhost,
port: rport,
service_name: ssl ? 'https' : 'http',
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: self.fullname,
origin_type: :service,
username: username,
private_data: password,
private_type: :password
}.merge(service_data)
credential_core = create_credential(credential_data)
login_data = {
core: credential_core,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
}.merge(service_data)
create_credential_login(login_data)
end
# Injects malicious SQL string to the methodDetail parameter against the target machine. # Injects malicious SQL string to the methodDetail parameter against the target machine.
# #
# @param method_detail [String] Malicious SQL injection string. # @param method_detail [String] Malicious SQL injection string.

View File

@ -116,7 +116,7 @@ class MetasploitModule < Msf::Exploit::Remote
return CheckCode::Unknown return CheckCode::Unknown
end end
report_tomcat_credential store_valid_credential(user: datastore['HttpUsername'], private: datastore['HttpPassword'])
vprint_status("Target is #{detect_platform(res.body)} #{detect_arch(res.body)}") vprint_status("Target is #{detect_platform(res.body)} #{detect_arch(res.body)}")
return CheckCode::Appears return CheckCode::Appears
@ -199,7 +199,7 @@ class MetasploitModule < Msf::Exploit::Remote
fail_with(Failure::Unknown, "Upload failed on #{path_tmp} [#{res.code} #{res.message}]") fail_with(Failure::Unknown, "Upload failed on #{path_tmp} [#{res.code} #{res.message}]")
end end
report_tomcat_credential store_valid_credential(user: datastore['HttpUsername'], private: datastore['HttpPassword'])
# #
# EXECUTE # EXECUTE
@ -297,35 +297,8 @@ class MetasploitModule < Msf::Exploit::Remote
} }
end end
def report_tomcat_credential def service_details
service_data = { super.merge({ access_level: 'Admin' })
address: ::Rex::Socket.getaddress(datastore['RHOST'],true),
port: datastore['RPORT'],
service_name: (ssl ? "https" : "http"),
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :service,
module_fullname: self.fullname,
private_type: :password,
private_data: datastore['HttpPassword'],
username: datastore['HttpUsername']
}
credential_data.merge!(service_data)
credential_core = create_credential(credential_data)
login_data = {
access_level: 'Admin',
core: credential_core,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
}
login_data.merge!(service_data)
create_credential_login(login_data)
end end
end end

View File

@ -124,7 +124,7 @@ class MetasploitModule < Msf::Exploit::Remote
vprint_status("Tomcat Manager found running on #{plat} platform and #{arch} architecture") vprint_status("Tomcat Manager found running on #{plat} platform and #{arch} architecture")
report_tomcat_credential store_valid_credential(user: datastore['HttpUsername'], private: datastore['HttpPassword'])
return CheckCode::Appears return CheckCode::Appears
end end
@ -146,7 +146,7 @@ class MetasploitModule < Msf::Exploit::Remote
# #
print_status("Uploading and deploying #{@app_base}...") print_status("Uploading and deploying #{@app_base}...")
if upload_payload if upload_payload
report_tomcat_credential store_valid_credential(user: datastore['HttpUsername'], private: datastore['HttpPassword'])
else else
fail_with(Failure::Unknown, "Upload failed") fail_with(Failure::Unknown, "Upload failed")
end end
@ -404,35 +404,8 @@ class MetasploitModule < Msf::Exploit::Remote
return true return true
end end
def report_tomcat_credential def service_details
service_data = { super.merge({ access_level: 'Admin' })
address: ::Rex::Socket.getaddress(datastore['RHOST'],true),
port: datastore['RPORT'],
service_name: (ssl ? "https" : "http"),
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :service,
module_fullname: self.fullname,
private_type: :password,
private_data: datastore['HttpPassword'],
username: datastore['HttpUsername']
}
credential_data.merge!(service_data)
credential_core = create_credential(credential_data)
login_data = {
access_level: 'Admin',
core: credential_core,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
}
login_data.merge!(service_data)
create_credential_login(login_data)
end end
end end

View File

@ -188,29 +188,7 @@ class MetasploitModule < Msf::Exploit::Remote
elsif res.code == 200 && /alt='ActualAnalyzer' src='https?:\/\/(?<analytics_host>[^\/^']+)/ =~ res.body elsif res.code == 200 && /alt='ActualAnalyzer' src='https?:\/\/(?<analytics_host>[^\/^']+)/ =~ res.body
vprint_good("Found analytics host: #{analytics_host}") vprint_good("Found analytics host: #{analytics_host}")
print_good("Login successful! (#{user}:#{pass})") print_good("Login successful! (#{user}:#{pass})")
service_data = { store_valid_credential(user: user, private: pass)
address: Rex::Socket.getaddress(rhost, true),
port: rport,
service_name: (ssl ? 'https' : 'http'),
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :service,
module_fullname: fullname,
private_type: :password,
private_data: pass,
username: user
}
credential_data.merge!(service_data)
credential_core = create_credential(credential_data)
login_data = {
core: credential_core,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
}
login_data.merge!(service_data)
create_credential_login(login_data)
return analytics_host return analytics_host
else else
vprint_status("Could not find any hosts on admin.php") vprint_status("Could not find any hosts on admin.php")

View File

@ -369,33 +369,6 @@ class MetasploitModule < Msf::Exploit::Remote
end end
end end
def report_cred(opts)
service_data = {
address: opts[:ip],
port: opts[:port],
service_name: opts[:service_name],
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :service,
module_fullname: fullname,
username: opts[:user],
private_data: opts[:password],
private_type: :nonreplayable_hash,
jtr_format: 'md5,raw-md5'
}.merge(service_data)
login_data = {
core: create_credential(credential_data),
status: Metasploit::Model::Login::Status::UNTRIED,
proof: opts[:proof]
}.merge(service_data)
create_credential_login(login_data)
end
def exploit def exploit
print_status("Checking for a valid node id...") print_status("Checking for a valid node id...")
node_id = get_node node_id = get_node
@ -416,14 +389,18 @@ class MetasploitModule < Msf::Exploit::Remote
for i in 0..count_users - 1 for i in 0..count_users - 1
user = get_user_data(node_id, i) user = get_user_data(node_id, i)
report_cred( connection_details = {
ip: rhost, module_fullname: self.fullname,
port: rport, username: user[0],
user: user[0], private_data: user[1],
password: user[1], private_type: :nonreplayable_hash,
service_name: (ssl ? "https" : "http"), jtr_format: 'md5,raw-md5',
proof: "salt: #{user[2]}" proof: "salt: #{user[2]}",
) status: Metasploit::Model::Login::Status::UNTRIED
}.merge(service_details)
create_credential_and_login(connection_details)
# why is this stored another way?
report_auth_info({ report_auth_info({
:host => rhost, :host => rhost,
:port => rport, :port => rport,

View File

@ -56,31 +56,13 @@ class MetasploitModule < Msf::Exploit::Remote
]) ])
end end
def report_cred(opts) def service_details
service_data = { super.merge({
address: opts[:ip], port: 445,
port: opts[:port], service_name: 'smb',
service_name: opts[:service_name],
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
module_fullname: fullname,
post_reference_name: self.refname, post_reference_name: self.refname,
private_data: opts[:password],
origin_type: :service,
private_type: :password,
username: opts[:user]
}.merge(service_data)
login_data = {
core: create_credential(credential_data),
status: opts[:status],
last_attempted_at: DateTime.now last_attempted_at: DateTime.now
}.merge(service_data) })
create_credential_login(login_data)
end end
def exploit def exploit
@ -172,14 +154,12 @@ class MetasploitModule < Msf::Exploit::Remote
'RunAsJob' => true 'RunAsJob' => true
) )
rescue rescue
report_cred( credential_data = {
ip: datastore['RHOST'],
port: 445,
service_name: 'smb',
user: user, user: user,
password: pass, private_data: pass,
status: Metasploit::Model::Login::Status::INCORRECT status: Metasploit::Model::Login::Status::INCORRECT
) }.merge(service_details)
create_credential_and_login(credential_data)
print_status("Login attempt using windows/smb/psexec failed") print_status("Login attempt using windows/smb/psexec failed")
print_status("Credentials have been stored and may be useful for authentication against other services.") print_status("Credentials have been stored and may be useful for authentication against other services.")
@ -188,14 +168,12 @@ class MetasploitModule < Msf::Exploit::Remote
end end
# report the auth # report the auth
report_cred( credential_data = {
ip: datastore['RHOST'], user: user,
port: 445, private_data: pass,
service_name: 'smb', status: Metasploit::Model::Login::Status::SUCCESSFUL
user: user, }.merge(service_details)
password: pass, create_credential_and_login(credential_data)
status: Metasploit::Model::Login::Status::SUCCESSFUL
)
handler handler
end end

View File

@ -349,7 +349,7 @@ class MetasploitModule < Msf::Exploit::Remote
if !res || (res.code != 200) if !res || (res.code != 200)
print_error("Login failed") print_error("Login failed")
elsif res.code == 200 elsif res.code == 200
report_octopusdeploy_credential store_valid_credential(user: datestore['USERNAME'], private: datastore['PASSWORD'])
end end
res res
@ -373,34 +373,7 @@ class MetasploitModule < Msf::Exploit::Remote
res res
end end
def report_octopusdeploy_credential def service_details
service_data = { super.merge({ access_level: 'Admin' })
address: ::Rex::Socket.getaddress(datastore['RHOST'], true),
port: datastore['RPORT'],
service_name: (ssl ? "https" : "http"),
protocol: 'tcp',
workspace_id: myworkspace_id
}
credential_data = {
origin_type: :service,
module_fullname: fullname,
private_type: :password,
private_data: datastore['PASSWORD'].downcase,
username: datastore['USERNAME']
}
credential_data.merge!(service_data)
credential_core = create_credential(credential_data)
login_data = {
access_level: 'Admin',
core: credential_core,
last_attempted_at: DateTime.now,
status: Metasploit::Model::Login::Status::SUCCESSFUL
}
login_data.merge!(service_data)
create_credential_login(login_data)
end end
end end