2月月赛WP
re1_wp
使用die打开 发现是一个.net编写的程序
因此使用dnspy打开文件,可以反编译出如下代码
程序的主要逻辑就是将flag文件进行aes加密,然后将随机生成的key和iv以及标识字符串写入末尾。
因此解密的逻辑也很清晰了,读取被加密的文件,提取出key和iv,然后解密文件,代码如下
public static void DecryptFile(string inputFilePath, string outputFilePath)
{
using (FileStream inputFileStream = new FileStream(inputFilePath, FileMode.Open, FileAccess.Read))
{
long totalLength = inputFileStream.Length;
if (totalLength < 56)
{
throw new InvalidOperationException("文件已损坏或格式不正确。");
}
byte[] metadata = new byte[56];
inputFileStream.Seek(-56, SeekOrigin.End);
inputFileStream.Read(metadata, 0, 56);
byte[] key = metadata.Take(32).ToArray();
byte[] iv = metadata.Skip(32).Take(16).ToArray();
byte[] identifierBytes = metadata.Skip(48).ToArray();
string actualIdentifier = Encoding.UTF8.GetString(identifierBytes);
if (actualIdentifier != identifier)
{
throw new InvalidOperationException("文件标识符不匹配,可能已被篡改。");
}
using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = key;
aesAlg.IV = iv;
aesAlg.Padding = PaddingMode.PKCS7;
aesAlg.Mode = CipherMode.CBC;
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
long encryptedDataLength = totalLength - 56;
inputFileStream.Seek(0, SeekOrigin.Begin);
using (FileStream outputFileStream = new FileStream(outputFilePath, FileMode.Create, FileAccess.Write))
using (CryptoStream cryptoStream = new CryptoStream(outputFileStream, decryptor, CryptoStreamMode.Write))
{
byte[] buffer = new byte[4096];
int bytesRead;
long bytesLeft = encryptedDataLength;
while (bytesLeft > 0)
{
int readSize = (int)Math.Min(buffer.Length, bytesLeft);
bytesRead = inputFileStream.Read(buffer, 0, readSize);
if (bytesRead == 0) break;
cryptoStream.Write(buffer, 0, bytesRead);
bytesLeft -= bytesRead;
}
cryptoStream.FlushFinalBlock();
}
}
}
Console.WriteLine($"文件 '{inputFilePath}' 已解密到 '{outputFilePath}'。");
}
或者手动提取key和iv 通过CyberChef也可解密
flag{asdfj@394P-33453495}
暗链
场景:网站某些路径被跳转到第三方恶意链接请排查原因
暗链排查1
点击超链接就会跳转至其他网站,通过抓包排查可发现响应中有一个js,大概率通过该js实现跳转
动态调试该JS,可获得FLAG
或base64解码+zlib最终得到暗链排查1的flag
暗链排查2
通过服务器提供的22端口上机排查
检查tomcat相关配置、文件,并无异常:
检查当前进程,可发现启动了两个nginx
通过检查当前nginx配置文件发现并没有相关的代码,且未找到对应的nginx1.conf,推测nginx1.conf应该就是最终导致被劫持的原因
通过导出该进程内存还原nginx1.conf
导出方法:
确认主进程pid
ps -ef |grep nginx
检查内存映射
cat /proc/pid/maps |grep heap
将返回结果:
556096ebf000-556096f24000 rw-p 00000000 00:00 0 [heap]
使用gdb转储堆
gdb -p master_pid
(gdb)dump memory /target/file 0x556096ebf000 0x556096f24000
最终可获得/target/file 通过查看该文件即可得到nginx配置文件
单机取证
WP
溯源完整过程记录
该wp使用Autopsy进行解答,也可以使用AccessData FTK Imager等工具进行仿真解答
某某文化有限公司的服务器被攻击了,领导发话了让小王看看攻击者对服务器做了什么找不出来就炒鱿鱼,请你拯救小王的运维生涯。
1.帮助小王找到是什么漏洞导致了小王的运维生涯受到了打击?(回答攻击者利用的漏洞编号)
flag格式为:flag{CNVD-20xx-12xxx}
CNVD-2022-60632
在桌面文件下可以看到服务器运行oa为用友TPlus,在"C:\Program Files (x86)\Chanjet\TPlusPro\WebServer\server\logs"可找到其日志。
将日志导出可看到ip:192.168.60.220在2025年2月18日对其进行大量目录扫描,随后进行漏洞验证并上传webshell然后与其连接
搜索其访问路径可得到漏洞编号
2.请你帮助小王找到攻击者使用的信息收集工具。(回答工具名称)
flag格式为:flag{xxxx.exe}
mimikatz.exe
在攻击者创建的隐藏账户桌面发现其使用的mimikatz.exe
3.帮助小王找到攻击者创建的隐藏账户的密码。
flag格式为:flag{xxxxxxxxxx}
666777888
导出SAM和SYSTEM(需配合 SYSTEM 注册表文件解密)
C:\Windows\System32\config\SAM
C:\Windows\System32\config\SYSTEM
使用impacket-secretsdump提取哈希
ccc8d64785a1f7981dd70c11f0928bb2
解密
4.小王发现系统中有什么文件一直被删除,你能找出来原因吗?(请回答包含的可疑域名)
flag格式为:flag{xxx.xxx.xxx}
0wwww.cyg2016.xyy
在桌面可看到运维留下的数据库密码本
在日志中也可以看到攻击者将“Ole Automation Procedures”已从 0 更改为1 启动了OLE自动化过程
sp_OACreate是SQL Server的扩展存储过程,用于创建OLE对象实例。odsole70.dll则是支持OLE自动化操作的组件,怀疑攻击者对数据库进行了操作。
作业信息存储
数据库作业信息存储在msdb
数据库中
如:
msdb.dbo.sysjobs
存储所有作业的基本信息(如作业名称、所有者、启用状态等)。
msdb.dbo.sysjobsteps
存储作业的步骤(Step)信息(如执行的命令、类型、成功/失败后的操作)。
msdb.dbo.sysschedules
存储作业的计划(Schedule)信息(如执行频率、时间)。
msdb.dbo.sysjobschedules
关联作业与计划(Job 和 Schedule 的对应关系)。
msdb.dbo.sysjobhistory
存储作业的执行历史记录(如开始时间、结束时间、执行状态)。
导出msdb数据库,并进行附加
执行命令查看作业详细
USE msdbDATA;
SELECT * FROM dbo.sysjobsteps;
将其十六进制进行转换
5.请你帮助小王找到攻击者隐藏的webshell后门,(请回答shell的md5值)
flag格式为:flag{xxxxxxxxx}
6e632aba24e8383a7e7a4d446dc285fc
可以在路径“C:\Program Files (x86)\Chanjet\TPlusPro\WebSite\WorkFlow”下发现其近期修改的“config.aspx”文件
对其文件进行分析可发现其具有以下行为:
通过 Application 对象存储恶意程序集、使用 AES + XOR 多层加密、反射加载 .NET 程序集等可判断其为后门文件。
导出文件计算md5
FLAG
1.帮助小王找到是什么漏洞导致了小王的运维生涯受到了打击?(回答攻击者利用的漏洞编号)
flag{CNVD-2022-60632}
2.请你帮助小王找到攻击者使用的信息收集工具。(回答工具名称)
flag{mimikatz.exe}
3.帮助小王找到攻击者创建的隐藏账户的密码。
flag{666777888}
4.小王发现系统中有什么文件一直被删除,你能找出来原因吗?(请回答包含的可疑域名)
flag{0wwww.cyg2016.xyy}
5.请你帮助小王找到攻击者隐藏的webshell后门,(请回答shell的md5值)
flag{6e632aba24e8383a7e7a4d446dc285fc}
vmdk修复
虚拟机无法打开,检查虚拟机文件,发现vmdk被加密
通过查看其他虚拟机的vmdk文件 可发现格式应为
version=1
encoding="GBK"
CID=ee578b63
parentCID=ffffffff
createType="twoGbMaxExtentSparse"
RW 8323072 SPARSE "a-s001.vmdk"
ddb.adapterType = "lsilogic"
ddb.geometry.cylinders = "15665"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.longContentID = "661640663b4c2e2767ac5685ee578b63"
ddb.toolsInstallType = "4"
ddb.toolsVersion = "12389"
ddb.uuid = "60 00 C2 9c 6c 76 ee 9f-e6 0b dc ed 20 04 11 b6"
ddb.virtualHWVersion = "21"
# Disk DescriptorFile
version=1
encoding="GBK"
CID=ee578b63
parentCID=ffffffff
createType="twoGbMaxExtentSparse"
Extent descriptions 部分
# Extent description
RW 8323072 SPARSE "a-s001.vmdk"
The Disk Data Base 部分
# The Disk Data Base
#DDB
ddb.adapterType = "lsilogic"
ddb.geometry.cylinders = "15665"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.longContentID = "661640663b4c2e2767ac5685ee578b63"
ddb.toolsInstallType = "4"
ddb.toolsVersion = "12389"
ddb.uuid = "60 00 C2 9c 6c 76 ee 9f-e6 0b dc ed 20 04 11 b6"
ddb.virtualHWVersion = "21"
DDB包含了关于虚拟磁盘的重要元数据和配置信息。
按照该格式进行修复可得到
version=1
encoding="GBK"
CID=ee578b63
parentCID=ffffffff
createType="twoGbMaxExtentSparse"
RW 8323072 SPARSE "Ubuntusy-s001.vmdk"
RW 8323072 SPARSE "Ubuntusy-s002.vmdk"
RW 8323072 SPARSE "Ubuntusy-s003.vmdk"
RW 8323072 SPARSE "Ubuntusy-s004.vmdk"
RW 8323072 SPARSE "Ubuntusy-s005.vmdk"
RW 8323072 SPARSE "Ubuntusy-s006.vmdk"
RW 8323072 SPARSE "Ubuntusy-s007.vmdk"
RW 8323072 SPARSE "Ubuntusy-s008.vmdk"
RW 8323072 SPARSE "Ubuntusy-s009.vmdk"
RW 8323072 SPARSE "Ubuntusy-s010.vmdk"
RW 8323072 SPARSE "Ubuntusy-s011.vmdk"
RW 8323072 SPARSE "Ubuntusy-s012.vmdk"
RW 8323072 SPARSE "Ubuntusy-s013.vmdk"
RW 8323072 SPARSE "Ubuntusy-s014.vmdk"
RW 8323072 SPARSE "Ubuntusy-s015.vmdk"
RW 8323072 SPARSE "Ubuntusy-s016.vmdk"
RW 8323072 SPARSE "Ubuntusy-s017.vmdk"
RW 8323072 SPARSE "Ubuntusy-s018.vmdk"
RW 8323072 SPARSE "Ubuntusy-s019.vmdk"
RW 8323072 SPARSE "Ubuntusy-s020.vmdk"
RW 8323072 SPARSE "Ubuntusy-s021.vmdk"
RW 8323072 SPARSE "Ubuntusy-s022.vmdk"
RW 8323072 SPARSE "Ubuntusy-s023.vmdk"
RW 8323072 SPARSE "Ubuntusy-s024.vmdk"
RW 8323072 SPARSE "Ubuntusy-s025.vmdk"
RW 8323072 SPARSE "Ubuntusy-s026.vmdk"
RW 8323072 SPARSE "Ubuntusy-s027.vmdk"
RW 8323072 SPARSE "Ubuntusy-s028.vmdk"
RW 8323072 SPARSE "Ubuntusy-s029.vmdk"
RW 8323072 SPARSE "Ubuntusy-s030.vmdk"
RW 1966080 SPARSE "Ubuntusy-s031.vmdk"
ddb.adapterType = "lsilogic"
ddb.geometry.cylinders = "15665"
ddb.geometry.heads = "255"
ddb.geometry.sectors = "63"
ddb.longContentID = "661640663b4c2e2767ac5685ee578b63"
ddb.toolsInstallType = "4"
ddb.toolsVersion = "12389"
ddb.uuid = "60 00 C2 9c 6c 76 ee 9f-e6 0b dc ed 20 04 11 b6"
ddb.virtualHWVersion = "21"
启动虚拟机后 进入安全模式可直接查看或修改密码查看flag