【代码审计】ECShop_V4.1.19 SQL注入漏洞 分析
关注user.php,当$action为wechat_token时


从php://input中获取xml数据,并解析,从中取出Event字段作为$method
最后用call_user_func_array调用new app\api\controller\WeChatEvent()#$method
我们来看app\api\controller\WeChatEvent()这个对象
它的scan方法调用markLogin,且从$data中提取EventKey和FromUserName字段

markLogin,存在sql注入

构造payload:
<?xml version="1.0"?>
<xml><Event>scan</Event><EventKey>' OR SLEEP(5) OR '1'='1</EventKey><FromUserName>test</FromUserName>
</xml>拼接后变为
select count(*) AS total_count from ecs_user_official where name = '' OR SLEEP(5) OR '1'='1'
