因此,首先需要传入两个参数text和file: text参数必须不为空,内容需要为I have a dream,file参数的内容则在后面的注释里提示我们为next.php,并且file参数里面不能包含/flag/,否则程序会终止 然后如果需要直接读取的话,我们需要通过伪协议base64编码之后输出到页面中 构造payload /?text=php://input&file=php://fi...
[BJDCTF2020]ZJCTF,不过如此 [BJDCTF2020]ZJCTF,不过如此 1.先看代码,提示了next.php,绕过题目的要求去回显next.php的base64加密内容 2.可以看到要求存在text内容而且text内容强等于后面的字符串,而且先通过这个if才能执行下面的file参数。 3.看到用的是file_get_contents()函数打开text。想到用data://协议 4.payl...
echo "".file_get_contents($text,'r').""; if(preg_match("/flag/",$file)){ die("Not now!"); } include($file); //next.php } else{ highlight_file(__FILE__); } ?> 没啥好说的,就差把思路写脸上了,text要i have a dream,文件名给你了next.php 直接给payload:?text=data...
看到file_get_contents()函数打开text参数,以及后面的文件包含函数,自然的想到php伪协议中的data://协议,来讲一些php伪协议: php:// 访问各个输入/输出流(I/O streams),在CTF中经常使用的是php://filter和php://input,php://filter用于读取源码,php://input用于执行php代码。php://filter读取源代码并进行bas...
BUU [BJDCTF2020]ZJCTF,不过如此 和BUU [ZJCTF 2019]NiZhuanSiWei一样。 ?text=data://text/plain,I have a dream&file=php://filter/read=convert.base64-encode/resource=next.php 得到next.php源码。 <?php$id = $_GET['id'];$_SESSION['id'] = $id;function complex($re, $str) {return preg...
[BJDCTF2020]ZJCTF,不过如此1 [BJDCTF2020]ZJCTF,不过如此1 进⼊题⽬,分析代码 file_get_contents() 把整个⽂件读⼊⼀个字符串中。通过get⽅式传⼊text,file参数,text参数要包含"i have a dream",且file参数正则匹配不能含有flag 看到⽤的是file_get_contents()函数打开text参数,以及后⾯的...
BJDCTF2020/BUUUCTF-WEB:ZJCTF,不过如此 BUUCTF web php <?php error_reporting(0); $text = $_GET["text"]; $file = $_GET["file"]; if(isset($text)&&(file_get_contents($text,'r')==="I have a dream")){ echo "".file_get_contents($text,'r').""; if(preg_match("/flag/",...
[BJDCTF2020]ZJCTF,不过如此 知识点 php://input filter伪协议 preg_replace() /e模式命令执行 题目源码 读取一下next.php preg_replace 当pattern传入的正则表达式带有/e时,存在命令执行,即当匹配到符合正则表达式的字符串时,第二个参数的字符串可被当做代码来执行。 这里第二个参数固定为strtolower(&qu......
[BJDCTF2020]ZJCTF,不过如此 [BJDCTF2020]ZJCTF,不过如此 打开靶场 直接给了源码 <?php error_reporting(0); $text = $_GET["text"]; $file = $_GET["file"]; if(isset($text)&&(file_get_contents($text,'r')==="I have a dream")){...
BUUCTF-web类题目:[BJDCTF2020]ZJCTF,不过如此、[ZJCTF 2019]NiZhuanSiWei php反序列化 直接可以看到给出的代码: <?php error_reporting(0); $text = $_GET["text"]; $file = $_GET["file"]; if(isset($text)&&(file_get_contents($text,'r')==="I have a dream")){ ...