Skip to content

Commit 5ef4cc2

Browse files
committed
Save creds
1 parent 1a371b1 commit 5ef4cc2

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

modules/exploits/multi/http/glassfish_deployer.rb

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,34 @@ def my_target_host
659659
my_target_host = "http://#{rhost.to_s}:#{rport.to_s}#{normalize_uri(datastore['PATH'])}"
660660
end
661661

662+
663+
def report_cred(opts)
664+
service_data = {
665+
address: rhost,
666+
port: rport,
667+
service_name: 'glassfish',
668+
protocol: 'tcp',
669+
workspace_id: myworkspace_id
670+
}
671+
672+
credential_data = {
673+
module_fullname: fullname,
674+
post_reference_name: self.refname,
675+
private_data: opts[:password],
676+
origin_type: :service,
677+
private_type: :password,
678+
username: opts[:user]
679+
}.merge(service_data)
680+
681+
login_data = {
682+
core: create_credential(credential_data),
683+
status: Metasploit::Model::Login::Status::SUCCESSFUL,
684+
last_attempted_at: DateTime.now
685+
}.merge(service_data)
686+
687+
create_credential_login(login_data)
688+
end
689+
662690
def try_normal_login(version)
663691
init_loginscanner
664692

@@ -693,6 +721,7 @@ def try_normal_login(version)
693721
print_status("Trying to login as #{cred.public}:#{cred.private}")
694722
result = @scanner.attempt_login(cred)
695723
if result.status == Metasploit::Model::Login::Status::SUCCESSFUL
724+
report_cred(user: cred.public, password: cred.private)
696725
return @scanner.jsession
697726
end
698727
end

0 commit comments

Comments
 (0)