Skip to content

Commit 522deaf

Browse files
committed
Remove the old MS-TDS SSL Proxy code
1 parent 5a77c18 commit 522deaf

File tree

2 files changed

+10
-160
lines changed

2 files changed

+10
-160
lines changed

lib/metasploit/framework/mssql/tdssslproxy.rb

Lines changed: 0 additions & 145 deletions
This file was deleted.

lib/rex/proto/mssql/client.rb

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'metasploit/framework/tcp/client'
2-
require 'metasploit/framework/mssql/tdssslproxy'
32
require 'rex/proto/mssql/client_mixin'
43
require 'rex/text'
54
require 'msf/core/exploit'
@@ -242,10 +241,6 @@ def mssql_prelogin(enc_error=false)
242241
data
243242
end
244243

245-
def mssql_ssl_send_recv(req, tdsproxy, timeout=15, check_status=true)
246-
tdsproxy.send_recv(req)
247-
end
248-
249244
def query(sqla, doprint=false, opts={})
250245
info = { :sql => sqla }
251246
opts[:timeout] ||= 15
@@ -415,6 +410,10 @@ def login_kerberos(user, pass, db, domain_name)
415410
pkt_hdr.packet_length += pkt_body.num_bytes
416411
pkt = pkt_hdr.to_binary_s + pkt_body.to_binary_s
417412

413+
if tdsencryption == true
414+
@mstds_channel.starttls
415+
end
416+
418417
# Rem : One have to set check_status to false here because sql server sp0 (and maybe above)
419418
# has a strange behavior that differs from the specifications
420419
# upon receiving the ntlm_negociate request it send an ntlm_challenge but the status flag of the tds packet header
@@ -467,12 +466,11 @@ def login_ntlm(user, pass, db, domain_name)
467466
# upon receiving the ntlm_negotiate request it send an ntlm_challenge but the status flag of the tds packet header
468467
# is set to STATUS_NORMAL and not STATUS_END_OF_MESSAGE, then internally it waits for the ntlm_authentification
469468
if tdsencryption == true
470-
#proxy = TDSSSLProxy.new(sock, sslkeylogfile: sslkeylogfile)
471-
#proxy.setup_ssl
472-
#resp = proxy.send_recv(pkt)
473469
@mstds_channel.starttls
474470
end
475471

472+
resp = mssql_send_recv(pkt)
473+
476474
# Strip the TDS header
477475
resp = resp[3..-1]
478476
type3 = ntlm_client.init_context([resp].pack('m'))
@@ -516,15 +514,12 @@ def login_sql(user, pass, db, _domain_name)
516514
pkt_hdr.packet_length += pkt_body.num_bytes
517515
pkt = pkt_hdr.to_binary_s + pkt_body.to_binary_s
518516

519-
if self.tdsencryption == true
520-
proxy = TDSSSLProxy.new(sock, sslkeylogfile: sslkeylogfile)
521-
proxy.setup_ssl
522-
resp = mssql_ssl_send_recv(pkt, proxy)
523-
proxy.cleanup
524-
else
525-
resp = mssql_send_recv(pkt)
517+
if tdsencryption == true
518+
@mstds_channel.starttls
526519
end
527520

521+
resp = mssql_send_recv(pkt)
522+
528523
info = {:errors => []}
529524
info = mssql_parse_reply(resp, info)
530525
self.initial_connection_info = info

0 commit comments

Comments
 (0)