第二届陇剑杯决赛Misc-Win

WriteUp 1年前 (2023) admin
267 0 0

win

@Name  : win@Game  : 2023 第二届陇剑杯决赛@Time  : 2023/9/16 @Type  : Misc@Description:1. 小明在一台电脑中获取了一个虚拟机文件以及桌面上存有 rockyou.txt,打开虚拟机的密码是多少?2. xshell 连接的密码是多少?3. 登陆脚本启动的程序路径是什么?4. 共访问了几次 www.baidu.com?@Flag:1. somewhere2. 123456a3. C:2333.bat4. 10

知识点

  1. vmx 文件爆破

  2. Xmanager 加解密

  3. windows 权限维持

  4. 浏览器数据取证

工具

  • pyvmx-cracker:vmx 文件爆破 https://github.com/axcheron/pyvmx-cracker

  • VMwareVMX:vmx 文件解密 https://github.com/RF3/VMwareVMX

  • how-does-Xmanager-encrypt-password:Xmanager 密码解密 https://github.com/HyperSine/how-does-Xmanager-encrypt-password

  • HackBrowserData:浏览器导出解密 https://github.com/moonD4rk/HackBrowserData

前置知识

VMware Workstation 的加密功能是不可逆的高强度加密,具体操作步骤:

新建一个任意虚拟机,然后点击“编辑虚拟机设置”→“选项”,可以看到“加密”,提示“该虚拟机未加密。你可以使用密码保护该虚拟机的数据和配置。”

虚拟机有一些配置文件:

Windows 7 x64.vmdk    //VMware 虚拟磁盘文件Windows 7 x64.vmsd    //VMware 快照元数据(存储密钥)Windows 7 x64.vmx    //VMware 虚拟机配置Windows 7 x64.vmxf    //VMware组成员

加密前的状态:

Windows 7 x64.vmdk    //正常Windows 7 x64.vmsd    //空白Windows 7 x64.vmx    //明文配置内容Windows 7 x64.vmxf    //明文配置内容

加密前的vmx文件:

.encoding = "GBK"config.version = "8"virtualHW.version = "20"mks.enable3d = "TRUE"pciBridge0.present = "TRUE"pciBridge4.present = "TRUE"pciBridge4.virtualDev = "pcieRootPort"pciBridge4.functions = "8"pciBridge5.present = "TRUE"pciBridge5.virtualDev = "pcieRootPort"pciBridge5.functions = "8"pciBridge6.present = "TRUE"pciBridge6.virtualDev = "pcieRootPort"pciBridge6.functions = "8"pciBridge7.present = "TRUE"pciBridge7.virtualDev = "pcieRootPort"pciBridge7.functions = "8"vmci0.present = "TRUE"hpet0.present = "TRUE"nvram = "Windows 7 x64.nvram"virtualHW.productCompatibility = "hosted"powerType.powerOff = "soft"powerType.powerOn = "soft"powerType.suspend = "soft"powerType.reset = "soft"usb.vbluetooth.startConnected = "TRUE"guestOS = "windows7-64"tools.syncTime = "FALSE"sound.autoDetect = "TRUE"sound.virtualDev = "hdaudio"sound.fileName = "-1"sound.present = "TRUE"cpuid.coresPerSocket = "1"memsize = "2048"mem.hotadd = "TRUE"scsi0.virtualDev = "lsisas1068"scsi0.present = "TRUE"sata0.present = "TRUE"scsi0:0.fileName = "Windows 7 x64.vmdk"scsi0:0.present = "TRUE"sata0:1.deviceType = "cdrom-image"sata0:1.fileName = "E:迅雷下载cn_windows_7_enterprise_x64_dvd_x15-70741.iso"...(省略)

加密后的状态:

Windows 7 x64.vmdk    //文件数据改变Windows 7 x64.vmsd    //增加密钥Windows 7 x64.vmx    //配置内容加密Windows 7 x64.vmxf    //无变化

加密后的vmx文件:

.encoding = "GBK"displayName = "Windows 7 x64"encryptedVM.guid = ""encryption.keySafe = "vmware:key/list/(pair/(phrase/tAEghLS8980%3d/pass2key%3dPBKDF2%2dHMAC%2dSHA%2d1%3acipher%3dAES%2d256%3arounds%3d10000%3asalt%3dy2uTjk2sa7ri9phabetHQA%253d%253d,HMAC%2dSHA%2d1,qipjap5UguTA5Evy1dipkNaW4xEtjoc9dkjcLKCXxOY1AK8GBi25tkYmApN98B6LuusWn%2b3hSLgJacDobycflOpwa%2bmw3xt%2fvnVT47asYLDXExOtjEiB6%2bGhU32CXMiD8bwkSp5f4IiKC62i2pn1BYgRRws%3d))"encryption.data = "Oo3FlZJquP2Km+9sibWZ5tTKGcHdMqt15lnsOx3fHDhsG/l5kFYJ5ikHUZY4...(省略)"

WriteUp

1. 小明在一台电脑中获取了一个虚拟机文件以及桌面上存有 rockyou.txt,打开虚拟机的密码是多少?

题目提供了一个 Windows 7 x64 虚拟机,导入后提示,虚拟机已经加密,需要输入密码:

第二届陇剑杯决赛Misc-Win

提示桌面上存有 rockyou.txt,这个应该就是爆破字典了。打开虚拟机配置文件 Windows 7 x64.vmx:

.encoding = "GBK"displayName = "Windows 7 x64"encryptedVM.guid = ""encryption.keySafe = "vmware:key/list/(pair/(phrase/tAEghLS8980%3d/pass2key%3dPBKDF2%2dHMAC%2dSHA%2d1%3acipher%3dAES%2d256%3arounds%3d10000%3asalt%3dy2uTjk2sa7ri9phabetHQA%253d%253d,HMAC%2dSHA%2d1,qipjap5UguTA5Evy1dipkNaW4xEtjoc9dkjcLKCXxOY1AK8GBi25tkYmApN98B6LuusWn%2b3hSLgJacDobycflOpwa%2bmw3xt%2fvnVT47asYLDXExOtjEiB6%2bGhU32CXMiD8bwkSp5f4IiKC62i2pn1BYgRRws%3d))"encryption.data = "Oo3FlZJquP2Km+9sibWZ5tTKGcHdMqt15lnsOx3fHDhsG/l5kFYJ5ikHUZY49Sjq1cErSEDioIt+VD65gAjId/NqxOUBuZxKCP7+/LAzI2vs5T+a7yOPO7LxM5GtR2sUeWv5fhtyhUqY/QCuHGTxZl4DviXmLYqMgBMyUqnERoXI3pg1PBEmIyaPGKnvrcl8eE+vF4bpp/rYojAffovQNWwPonvG5ghtYOix4XMsiBmGuxeGHj9C5i3GwDzCkrWDb2DGYO4HXpZNiSSvUezvf+aqBPBMA2Vn9X3nuGW97Ij8HQ9jQnMFeZ2yWlWuuFu1XYsKTjfjiYL5esNgAsycnWMD/1a2wYBGab/SuBSqnGxHh441OBjC3oXjGLRMNJRFQVRBHvnw5KGYhzKdX51CaS8axziFKLjZHcBdJu9uPSJuigFEhg0S9hwlUd7skN+qXXGdG9XRAg3P8s8LucwiEJgX7rAxxUoVeSPsO/Tm2wvUqtLoEUM4YL16N5Vc692sqUitu5muq1cqjrijEt2q+SwesaLe8rM2LtAnZ/HafUXbw5hqLhwwEaHywLI/RVynA6aDgxWxOIPGqK3uetjQo6L/AZO7AXxoWq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uWgc7NfDIof8NBFM7Q="

其中,还原 vmsd 文件需要:

encryption.keySafe = "vmware:key/list/(pair/(phrase/tAEghLS8980%3d/pass2key%3dPBKDF2%2dHMAC%2dSHA%2d1%3acipher%3dAES%2d256%3arounds%3d10000%3asalt%3dy2uTjk2sa7ri9phabetHQA%253d%253d,HMAC%2dSHA%2d1,qipjap5UguTA5Evy1dipkNaW4xEtjoc9dkjcLKCXxOY1AK8GBi25tkYmApN98B6LuusWn%2b3hSLgJacDobycflOpwa%2bmw3xt%2fvnVT47asYLDXExOtjEiB6%2bGhU32CXMiD8bwkSp5f4IiKC62i2pn1BYgRRws%3d))"

两遍 URLDecode 得到:

encryption.keySafe = "vmware:key/list/(pair/(phrase/tAEghLS8980=/pass2key=PBKDF2-HMAC-SHA-1:cipher=AES-256:rounds=10000:salt=y2uTjk2sa7ri9phabetHQA==,HMAC-SHA-1,qipjap5UguTA5Evy1dipkNaW4xEtjoc9dkjcLKCXxOY1AK8GBi25tkYmApN98B6LuusWn 3hSLgJacDobycflOpwa mw3xt/vnVT47asYLDXExOtjEiB6 GhU32CXMiD8bwkSp5f4IiKC62i2pn1BYgRRws=))"

使用工具 pyvmx-cracker 和字典 rockyou.txt 爆破。

该工具需要修改注释掉 pyvmx-cracker.py 的第 108 行、109 行代码,否则会报错。题目中第三行是 encryptedVM.guid,也可以将 vmx 文件中的第三行注释掉。

if 'encryption.keySafe' not in lines[2]:  sys.exit('[-] Invalid VMX file or the VMX is not encrypted')

实际上的字典比较大,此处仅为示例。执行命令:

python3 pyvmx-cracker.py -v /YOUR/PATH/TO/VMX.vmx -d /YOUR/PATH/TO/ROCKYOU.txt

第二届陇剑杯决赛Misc-Win

得到密码为 somewhere。

可以使用 VMwareVMX 对 vmx 文件进行解密:

python3 main.py /YOUR/PATH/TO/VMX.vmx > /YOUR/PATH/TO/DECODE_VMX/decode.vmx

也可以直接输入密码,或使用解密后的 vmx,打开虚拟机进行下一步操作。

还可以通过VMware Workstation 移除加密,”虚拟机设置“→”选项“→”访问控制“→”移除加密“。

2. xshell 连接的密码是多少?

一般来说,xshell 账号密码文件位置如下:

Xshell7  C:Users%username%DocumentsNetSarang Computer7XshellSessionsXshell6  C:Users%username%DocumentsNetSarang Computer6XshellSessionsXShell5  %userprofile%DocumentsNetSarangXshellSessionsXFtp5  %userprofile%DocumentsNetSarangXftpSessionsXShell6  %userprofile%DocumentsNetSarang Computer6XshellSessionsXFtp6  %userprofile%DocumentsNetSarang Computer6XftpSessions

本题中,xshell 账号密码文件位置如下:

Xshell6  C:UserstestttDocumentsNetSarang Computer6XshellSessions

.xsh 文件中包含连接密码:

第二届陇剑杯决赛Misc-Win

当前用户名和sid:

第二届陇剑杯决赛Misc-Win

解密得到 xshell 连接的密码 123456a

python XShellCryptoHelper.py -d -user testtt -sid S-1-5-21-1844938145-4200775270-4174914976-1000 p5orZNxx2PcH/dp8h0/0nr+yyIooYMX/TOPZSiHvt2VmrQ+Sya1X

第二届陇剑杯决赛Misc-Win

另一个思路是上线本地cs,直接 dump 密码。

3. 登陆脚本启动的程序路径是什么?

镜像启动会弹出一个 calc 计算器,所以首先需要排查开机启动项。

查看 Windows 启动开机启动项,发现 C:2333.bat

C:UserstestttAppDataRoamingMicrosoftWindowsStart MenuProgramsStartup

进入注册表查看,发现攻击者创建了 Logon Scripts,以优先启动攻击脚本。注册表路径:

HKEY_CURRENT_USEREnvironment

第二届陇剑杯决赛Misc-Win

登录脚本启动的程序路径即为 C:2333.bat

4. 共访问了几次 www.baidu.com?

用 HackBrowserData 获取历史浏览数据 firefox_81rc7g54_default_esr_history.csv

第二届陇剑杯决赛Misc-Win

访问了 10 次百度:

第二届陇剑杯决赛Misc-Win



原文始发于微信公众号(黑伞安全):第二届陇剑杯决赛Misc-Win

版权声明:admin 发表于 2023年9月22日 上午11:33。
转载请注明:第二届陇剑杯决赛Misc-Win | CTF导航

相关文章

暂无评论

您必须登录才能参与评论!
立即登录
暂无评论...