攻防世界-file_include(江苏工匠杯)

题目

描述:怎么读取文件呢?

<?php
highlight_file(__FILE__);
    include("./check.php");
    if(isset($_GET['filename'])){
        $filename  = $_GET['filename'];
        include($filename);
    }
?>

尝试伪协议读取

php://filter/read/convert.base64-encode/resource=check.php

出现提示,说明某些被过滤,那么接下来可以猜测哪些被过滤了,可以一个个去匹配查找,例如

在网上寻找关于filter的绕过,了解到一篇文章,说了一些关于过滤器的知识

转载:https://blog.csdn.net/woshilnp/article/details/117266628

convert.iconv.*

这个过滤器需要php支持 iconv ,而iconv是默认编译的。使用convert.iconv.*过滤器等同于用iconv()函数处理所有的流数据。

convery.iconv.*的使用有两种方法:

convert.iconv.<input-encoding>.<output-encoding> 
or 
convert.iconv.<input-encoding>/<output-encoding>
//支持的编码
UCS-4*
UCS-4BE
UCS-4LE*
UCS-2
UCS-2BE
UCS-2LE
UTF-32*
UTF-32BE*
UTF-32LE*
UTF-16*
UTF-16BE*
UTF-16LE*
UTF-7
UTF7-IMAP
UTF-8*
ASCII*

接下来使用burp进行编码

可以看到第一个使用UTF-7第二个使用UTF-32,尝试一下

看到一些过滤,此时猜测flag文件为flag.php

得到flag:cyberpeace{5cde5c3284f44c7dd1156442bd1c9d76}

posted @ 2022-11-16 17:27  诗酒于人  阅读(919)  评论(2)    收藏  举报