[网鼎杯 2020 半决赛]AliceWebsite
首先题目给出了源代码,包含index.php
,about.php
和home.php
。
其中index.php
存在文件包含漏洞。
1 2 3 4 5 6 7 8
| <?php $action = (isset($_GET['action']) ? $_GET['action'] : 'home.php'); if (file_exists($action)) { include $action; } else { echo "File not found!"; } ?>
|
代码虽然限制了文件必须存在,但尝试访问/etc/passwd是可以访问到的。故直接访问/flag
![image-20220315200601374](/%E7%BD%91%E9%BC%8E%E6%9D%AF-2020-%E5%8D%8A%E5%86%B3%E8%B5%9B-AliceWebsite/image-20220315200601374.png)