EMLOG Pro 2.6.1代码问题漏洞CVE-2026-22799
EMLOG是EMLOG开源的一套基于PHP和MySQL开发的轻量级开源博客与 CMS 建站系统的专业版本,主打轻量高效、易上手、可扩展。
EMLOG Pro 适合个人博客、小型企业站、内容聚合站点搭建,程序代码精简、资源占用低,运行速度快,适合低配服务器与云主机部署。
一、基本情况
EMLOG Pro 相比免费社区版,它在功能、权限、生态与安全上全面增强,兼顾个人与小型团队的专业建站需求,并且管理门槛非常的低。
栋科技博客就是基于 EMLOG Pro 程序搭建的,本站随时跟随官方版本同步更新程序,从而实现追求简单高效的博客搭建与运营的目标。

EMLOG Pro 2.6.1 版本发布于2026年01月01日,该版本 实现了核心和应用支持多语言方案,优化了插件前台界面不显示404等等的问题。
栋科技漏洞库关注到 EMLOG Pro 2.6.1及之前版本中存在的任意文件上传漏洞,已追踪为CVE-2026-22799,漏洞CVSS 3.X评分7.7。
二、漏洞分析
CVE-2026-22799漏洞是存在于EMLOG Pro 2.6.1及之前版本存在代码问题漏洞,该漏洞可能会导致远程代码执行等等诸多严重是后果。
该版本暴露了一个用于媒体文件上传的 REST API 端点(/index.php?rest-api=upload),该端点未正确验证文件类型、扩展名和内容。
漏洞源于REST API端点未对文件类型、扩展名和内容实施适当验证,可能导致经过身份验证的攻击者上传任意文件,包括恶意PHP脚本。
使得经过身份验证的攻击者(拥有有效的 API 密钥或管理员会话 cookie)能够向服务器上传任意文件(包括恶意 PHP 脚本)。
攻击者可以通过获取管理员权限以启用REST API设置,或者利用应用程序中的信息泄露漏洞来获取API密钥。
一旦上传恶意PHP文件,该文件就会被执行,从而在目标服务器上实现远程代码执行(RCE),导致服务器完全被攻破。
1、漏洞原因
该漏洞源于文件上传工作流程中的多个关键缺陷
文件类型验证缺失:
Api_Controller中的上传方法仅检查是否提供了文件($attach || $attach['error'] === 4),但未验证文件的MIME类型、扩展名或内容。
无限制文件存储:
Media_Model::addMedia在将文件元数据(包括原始文件名和路径)存储到数据库时未对文件名进行任何处理,也未限制允许的扩展名。
不安全的文件处理:
upload2local动作处理程序(通过doOnceAction调用)未执行文件扩展名白名单检查,导致PHP文件可直接上传。
2、关键易受攻击的代码片段
(1)Api_Controller::upload(REST API端点)
public function upload()
{
$sid = Input::postIntVar('sid');
$author_uid = Input::postIntVar('author_uid', 1);
$attach = isset($_FILES['file']) ? $_FILES['file'] : '';
$this->checkApiKey();
// Only checks if file exists - NO type/extension validation
if (!$attach || $attach['error'] === 4) {
Output::error('Upload error');
}
$ret = '';
addAction('upload_media', 'upload2local');
doOnceAction('upload_media', $attach, $ret);
if (empty($ret['success']) || !isset($ret['file_info'])) {
Output::error($ret['message']);
}
// Blindly stores the file without validation
$aid = $this->Media_Model->addMedia($ret['file_info'], $sid, $author_uid);
Output::ok(['media_id' => $aid, 'url' => $ret['url'], 'file_info' => $ret['file_info']]);
}
(2)Media_Model::addMedia(文件元数据存储)
function addMedia($file_info, $sortid = 0, $uid = UID)
{
$file_name = $file_info['file_name'];
$file_size = $file_info['size'];
$file_path = $file_info['file_path'];
$file_mime_type = $file_info['mime_type'];
$img_width = $file_info['width'];
$img_height = $file_info['height'];
$create_time = time();
$alias = getRandStr(16, false);
if (isset($file_info['thum_file'])) {
$file_path = $file_info['thum_file'];
}
// No sanitization of filename/extension before database insertion
$query = "INSERT INTO $this->table (alias, author, sortid, filename, filesize, filepath, addtime, width, height, mimetype, thumfor)
VALUES('%s', '%d', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')";
$query = sprintf($query, $alias, $uid, $sortid, $file_name, $file_size, $file_path, $create_time, $img_width, $img_height, $file_mime_type, 0);
$this->db->query($query);
return $this->db->insert_id();
}
3、影响代码
include/controller/api_controller.php
@@ -554,6 +554,11 @@ public function upload()
Output::error('Upload error');
}
$uploadCheckResult = Media::checkUpload($attach);
if ($uploadCheckResult !== true) {
Output::error($uploadCheckResult);
}
$ret = '';
addAction('upload_media', 'upload2local');
doOnceAction('upload_media', $attach, $ret);
三、POC概念验证
1、请求详情
管理员已设置登录后刷新可查看2、预期结果
1、服务器以200 OK状态响应,并返回上传文件的URL,例如如下链接
{"code":0,"msg":"ok","data":{"media_id":8,"url":"http:\/\/127.0.0.1\/content\/uploadfile\/202601\/4cb11767857658.php","file_info":{"file_name":"12399227.php","mime_type":"text\/html","size":19,"width":0,"height":0,"file_path":"..\/content\/uploadfile\/202601\/4cb11767857658.php"}}}

2、访问返回的URL(http://target-ip/content/uploadfile/[data]/xxxxx.php)会执行phpinfo()函数,从而确认任意PHP代码的执行。

3、潜在风险
远程代码执行:攻击者可以上传并执行恶意PHP脚本,以窃取敏感数据(如数据库凭据)、修改网站内容或完全控制服务器。
数据泄露:被入侵的服务器可能会暴露存储在emlog数据库中的用户凭证、博客内容和其他敏感信息。
服务器被攻破:攻击者可以利用远程代码执行(RCE)来安装恶意软件、创建后门或参与僵尸网络活动。
四、影响范围
EMLOG Pro <= 2.6.1
五、修复建议
EMLOG Pro >= 2.6.1
六、参考链接
管理员已设置登录后刷新可查看