FreePBX管理模块中的命令注入CVE-2025-64328
FreePBX Endpoint Manager(EPM)是 FreePBX 系统的核心模块之一,主要用于IP 电话、网关、寻呼设备等终端的自动化配置与管理。
一、基本情况
FreePBX Endpoint Manager是FreePBX系统管理电话终端模块,通过 FTP、TFTP 或 HTTP 协议终端自动配置,无需手动设置设备参数。

FreePBX Endpoint Manager分为开源版和商业版,前者免费但无官方商业支持,后者由 Sangoma 提供技术支持并包含更多高级功能。
栋科技漏洞库关注到 FreePBX Endpoint Manager 受影响版本中存在的安全漏洞,该漏洞追踪为CVE-2025-64328,CVSS 4.0评分为8.6。
二、漏洞分析
CVE-2025-64328位于 FreePBX Endpoint Manager 版本17.0.2.36及更高版本至版本17.0.3之前的版本中中,漏洞已在17.0.3中得到修复。
这是管理界面中的文件存储模块存在已知认证用户通过testconnection -> check_ssh_connect()函数进行身份验证后的命令注入漏洞。
漏洞代码如下:
<?php
function check_ssh_connect($host, $port, $user, $key, $path) {
$keypath = dirname($key);
$publickey = "$key.pub";
if(!is_dir($keypath)) {
exec("mkdir -p $keypath");
}
if(!file_exists($key)) {
exec("ssh-keygen -t ecdsa -b 521 -f $key -N \"\" && chown asterisk:asterisk $key && chmod 600 $key");
}
if(!file_exists($publickey)) {
exec("ssh-keygen -y -f $key > $publickey");
}
$connection = @ssh2_connect($host, $port);
if(!$connection) {
return "Connect failed";
}
else { // Connection to the Server could be established
if(!@ssh2_auth_pubkey_file($connection, $user, $publickey, $key)) {
@ssh2_disconnect($connection);
return "Login failed";
}
else {
$stream = ssh2_exec($connection,"cd $path");
$errorStream = ssh2_fetch_stream($stream, SSH2_STREAM_STDERR);
stream_set_blocking($errorStream, true);
stream_set_blocking($stream, true);
$error = stream_get_contents($errorStream);
if($error != "") {
@ssh2_disconnect($connection);
return "Chdir failed";
}
else {
$now = time();
$file = "/tmp/freepbx_test$now.txt";
file_put_contents($file, "FreePBX Filestore Test");
$filename = basename($file);
if(!@ssh2_scp_send($connection, "$file", "$path/$filename", 0644)) {
@ssh2_disconnect($connection);
unlink($file);
return "Write failed";
}
else {
$stream = ssh2_exec($connection,"rm $path/$file");
unlink($file);
return "OK";
}
}
}
}
}
?>
该漏洞的潜在影响是,任何有权访问FreePBX管理面板的用户都可以利用此漏洞在底层主机上执行任意shell命令。
这意味着攻击者可以利用该漏洞以Asterisk用户的身份远程访问系统,因此漏洞利用的前提是需要使用已知用户名进行身份验证。
三、影响范围
17.0.2.36 >= FreePBX Endpoint Manager > 17.0.3
四、修复建议
security-reporting >= 17.0.3
五、参考链接
管理员已设置登录后刷新可查看