@@ -15,6 +15,7 @@ module Exploit::Remote::HttpClient
1515
1616 include Msf ::Auxiliary ::Report
1717 include Msf ::Auxiliary ::LoginScanner
18+ include Msf ::Exploit ::Remote ::Kerberos ::Ticket ::Storage
1819
1920 #
2021 # Initializes an exploit module that exploits a vulnerability in an HTTP
@@ -155,6 +156,25 @@ def connect(opts={})
155156
156157 http_logger_subscriber = Rex ::Proto ::Http ::HttpLoggerSubscriber . new ( logger : self )
157158
159+ if datastore [ 'HTTP::Auth' ] == Msf ::Exploit ::Remote ::AuthOption ::KERBEROS
160+ kerberos_authenticator = Msf ::Exploit ::Remote ::Kerberos ::ServiceAuthenticator ::HTTP . new (
161+ host : datastore [ 'DomainControllerRhost' ] ,
162+ hostname : datastore [ 'HTTP::Rhostname' ] ,
163+ proxies : datastore [ 'Proxies' ] ,
164+ realm : datastore [ 'DOMAIN' ] ,
165+ username : datastore [ 'HttpUsername' ] ,
166+ password : datastore [ 'HttpPassword' ] ,
167+ timeout : 20 , # datastore['timeout']
168+ framework : framework ,
169+ framework_module : self ,
170+ cache_file : datastore [ 'HTTP::Krb5Ccname' ] . blank? ? nil : datastore [ 'HTTP::Krb5Ccname' ] ,
171+ mutual_auth : true ,
172+ use_gss_checksum : true ,
173+ ticket_storage : kerberos_ticket_storage ,
174+ offered_etypes : Msf ::Exploit ::Remote ::AuthOption . as_default_offered_etypes ( datastore [ 'HTTP::KrbOfferedEncryptionTypes' ] )
175+ )
176+ end
177+
158178 nclient = Rex ::Proto ::Http ::Client . new (
159179 opts [ 'rhost' ] || rhost ,
160180 ( opts [ 'rport' ] || rport ) . to_i ,
@@ -167,6 +187,7 @@ def connect(opts={})
167187 proxies ,
168188 client_username ,
169189 client_password ,
190+ kerberos_authenticator : kerberos_authenticator ,
170191 comm : opts [ 'comm' ] ,
171192 subscriber : http_logger_subscriber ,
172193 sslkeylogfile : sslkeylogfile
@@ -375,6 +396,22 @@ def send_request_raw(opts = {}, timeout = 20, disconnect = false)
375396 actual_timeout = opts [ :timeout ] || timeout
376397 end
377398
399+ unless opts . key? ( 'preferred_auth' )
400+ case datastore [ 'HTTP::Auth' ]
401+ when Msf ::Exploit ::Remote ::AuthOption ::AUTO
402+ opts [ 'preferred_auth' ] = nil
403+ when Msf ::Exploit ::Remote ::AuthOption ::KERBEROS
404+ opts [ 'preferred_auth' ] = 'Kerberos'
405+ when Msf ::Exploit ::Remote ::AuthOption ::NTLM
406+ opts [ 'preferred_auth' ] = 'NTLM'
407+ when Msf ::Exploit ::Remote ::AuthOption ::PLAINTEXT
408+ # Basic auth might as well be plaintext right?
409+ opts [ 'preferred_auth' ] = 'Basic'
410+ when Msf ::Exploit ::Remote ::AuthOption ::NONE
411+ opts [ 'preferred_auth' ] = 'None'
412+ end
413+ end
414+
378415 c = opts [ 'client' ] || connect ( opts )
379416 r = opts [ 'cgi' ] ? c . request_cgi ( opts ) : c . request_raw ( opts )
380417
0 commit comments