
ZoneMinder Time-Based SQL Injection (CVE-2024-51482) Exploit POC
This repository contains a high-performance, parallelized proof-of-concept (PoC) exploit (Exploit.py) for a Blind SQL Injection vulnerability found in ZoneMinder versions 1.37.* up to 1.37.64.
According to GHSA-qm8h-3xvf-m7j3, the vulnerability originates in web/ajax/event.php when handling the removetag action. The tid (TagId) parameter is read from the request and insecurely concatenated directly into a SQL statement:
$tagId = $_REQUEST['tid'];
// ...
$sql = "SELECT * FROM Events_Tags WHERE TagId = $tagId";
$rowCount = dbNumRows($sql);
Because $tagId is not parameterized before being passed to dbNumRows(), an authenticated attacker can inject arbitrary SQL commands using boolean-based or time-based SQL injection techniques (the PoC presented here leverages SLEEP()).
This allows for total control of SQL Databases, leading to a loss of data confidentiality and integrity, and potentially Denial of Service (DoS) via persistent sleep commands.
As of version 1.37.65, the SQL queries have been properly parameterized. The vulnerable block was patched to construct a secure query:
$sql = "SELECT * FROM Events_Tags WHERE TagId = ?";
$rowCount = dbNumRows($sql, $tagId);
The v2.0 FAST EXPLOIT script significantly speeds up data extraction by up to 5x using multi-threading, an optimized character frequency search, and dynamic threshold calibration to aggressively extract user credentials (Username:Password) from the zm.Users database table.
Exploit.py v2.0 FAST EXPLOIT)zm.Users table.http://<target>/zm/index.phpview=request&request=event&action=removetagtidpython3 Exploit.py
Upon execution, the script runs in an interactive mode and prompts for the following:
index.php file (e.g., http://zoneminder.local/zm/index.php).ZMSESSID cookie representing an active session.zm.Users table.A file named extracted_data.txt is automatically created with the dumped credentials (in Username:Password format). The script also displays real-time execution statistics including total elapsed time and the total number of HTTP requests sent.
Disclaimer: This exploit script is intended strictly for educational purposes and authorized penetration testing. Do not use this tool against systems you do not own or possess explicit permission to test.