BUU29 [网鼎杯 2020 朱雀组]phpweb1

开幕雷击:

听不懂思密达

抓个包看看

发现传入一个函数

复制代码
func=date&p=Y-m-d+h%3Ai%3As+a

p 通常作为参数的值传递给前面指定的函数,将其url解码后得到 Y-m-d h:i:s a,这是 date() 函数中用于指定日期和时间格式的字符串

  • Y:表示四位数的年份,例如 2025
  • m:表示两位数的月份,范围从 0112
  • d:表示两位数的日期,范围从 0131
  • h:表示 12 小时制的小时数,范围从 0112
  • i:表示分钟数,范围从 0059
  • s:表示秒数,范围从 0059
  • a:表示上午或下午,值为 ampm

尝试着这么构造,发现不行

输入

html 复制代码
func=highlight_file&p=index.php 

这样就能看见源代码了

另一种读取源代码方式:file_get_content()

html 复制代码
<!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>

call_user_func() 函数允许你将函数名作为一个字符串传递给该函数,并可以向被调用的函数传递参数。

利用反序列化漏洞,既然可以执行任何函数,那么就可以执行unserialize()

然后就能遍历目录,但是没有flag

查看根目录:

还是没有

用find搜索:

html 复制代码
find / -name flag*

发现有flag

使用cat命令

拿到flag

相关推荐
德迅云安全-小潘16 小时前
网络威胁演变与态势感知的防御
安全·web安全
m0_4660499717 小时前
Webgoat-(A1)Broken Access Control:Hijack a session
web安全·网络安全
Chengbei1118 小时前
CVE-2025-24813 Tomcat 最新 RCE 分析复现
java·安全·web安全·网络安全·tomcat·系统安全·网络攻击模型
德迅云安全-小潘18 小时前
网络空间资产安全发展演进与实践框架
数据库·web安全
Blossom.11819 小时前
多模态大模型实战:从零实现CLIP与电商跨模态检索系统
python·web安全·yolo·目标检测·机器学习·目标跟踪·开源软件
GoldY丶20 小时前
【Geek渗透之路】小迪安全笔记——web安全(3)
笔记·安全·web安全·网络安全·安全威胁分析
金灰2 天前
一带一路(金砖)--网络安全防护治理赛项
网络·计算机网络·安全·web安全·网络安全·网络攻击模型·安全威胁分析
是喵斯特ya2 天前
python开发web暴力破解工具(进阶篇 包含验证码识别和token的处理)
开发语言·python·web安全
bleach-2 天前
应急响应之入侵检测排查——Windows篇—,Windows日志介绍分析
windows·安全·web安全·网络安全·系统安全
合才科技2 天前
【要闻周报】网络安全与数据合规 12-20
安全·web安全