- A+
所属分类:Seay信息安全博客
显示不全请点击全屏阅读
普通会员登录网站后,通过恶意构造的URL可以实现对整个网站的收货地址查看、修改、和删除。
造成用户敏感隐私泄漏和网站不必要的损失。
详细说明:
core/shop/controller/ctl.member.php文件
//修改收货地址
function modifyReceiver($addrId){
$oMem = &$this->system->loadModel(‘member/member’);
if($aRet = $oMem->getAddrById($addrId)){
$aRet[‘defOpt’] = array(‘0’=>__(‘否’), ‘1’=>__(‘是’));
$this->pagedata = $aRet;
}else{
$this->system->error(404);
exit;
}
$this->_output();
}
function saveRec(){
$this->begin($this->system->mkUrl(‘member’,’modifyReceiver’,array($_POST[‘addr_id’])));
$oMem = &$this->system->loadModel(‘member/member’);
if($oMem->saveRec($_POST,$this->member[‘member_id’],$message)){
$this->redirect(‘member’,’receiver’);
}
trigger_error($message, E_USER_ERROR);
$this->end(false,__(‘修改失败’),$this->system->mkUrl(‘member’,’modifyReceiver’,array($_POST[‘addr_id’])));
}
//删除收货地址
function delRec($addrId){
$oMem = &$this->system->loadModel(‘member/member’);
if($oMem->delRec($addrId)){
$this->redirect(‘member’,’receiver’);
}
$this->_output();
}
以上三个函数没有对所修改的地址所属用户ID进行判断,造成用户信息泄漏和安全隐患。
漏洞证明:
打开任意shopex4.85网站,注册会员登录后,
修改以下URL中的ID属性
/?member-21-modifyReceiver.html 可显示和修改其他用户的地址
/?member-21-delRec.html 可删除其他用户的地址
修复方案:
函数添加对用户ID的判断
//修改收货地址
function modifyReceiver($addrId){
$oMem = &$this->system->loadModel(‘member/member’);
if($aRet = $oMem->getAddrById($addrId)){
if($aRet[‘member_id’]!=$this->member[‘member_id’]){
$this->system->error(404);
exit;
}else{
$aRet[‘defOpt’] = array(‘0’=>__(‘否’), ‘1’=>__(‘是’));
$this->pagedata = $aRet;
}
}else{
$this->system->error(404);
exit;
}
$this->_output();
}
function saveRec(){
$this->begin($this->system->mkUrl(‘member’,’modifyReceiver’,array($_POST[‘addr_id’])));
$oMem = &$this->system->loadModel(‘member/member’);
foreach($_POST as $ke=>$ve){
$_POST[$ke] = strip_tags($ve);
}
if($aRet = $oMem->getAddrById($_POST[‘addr_id’])){
if($aRet[‘member_id’]!=$this->member[‘member_id’]){
$this->system->error(404);
exit;
}
}
if($oMem->saveRec($_POST,$this->member[‘member_id’],$message)){
$this->redirect(‘member’,’receiver’);
}
trigger_error($message, E_USER_ERROR);
$this->end(false,__(‘修改失败’),$this->system->mkUrl(‘member’,’modifyReceiver’,array($_POST[‘addr_id’])));
}
//删除收货地址
function delRec($addrId){
$oMem = &$this->system->loadModel(‘member/member’);
if($aRet = $oMem->getAddrById($_POST[‘addr_id’])){
if($aRet[‘member_id’]!=$this->member[‘member_id’]){
$this->system->error(404);
exit;
}
}
if($oMem->delRec($addrId)){
$this->redirect(‘member’,’receiver’);
}
$this->_output();
}
作者:Steven
Tags:
如果您喜欢我的博客,欢迎点击图片定订阅到邮箱 也可以点击链接【订阅到鲜果】
如果我的想法或工具帮助到了你,也可微信扫下方二维码打赏本人一杯咖啡