国产成人毛片毛片久久网_国产午夜激无码av毛片不_国产乱对白精彩在线播放_av资源站中文字幕_亚洲男人的天堂网站_国产成 人 综合 亚洲网_中国国产激情一区_少妇一级淫片免费放_亚洲一本大道av久在线播放_免费观看美女裸体网站

安全播報

防御吧作為15年知名老牌域名服務商,CNNIC和CANN雙認證域名注冊商,已經(jīng)
持續(xù)為500多萬個域名提供服務,包括智能DNS/自由轉(zhuǎn)移/隱私保護等服務!
如何使用WFH搜索Windows可執(zhí)行程序中的常見漏洞或功能
2021-08-12 14:38:14 【

關(guān)于WFH

WFH,全名為Windows Feature Hunter,即Windows功能搜索工具,該工具基于Python開發(fā),使用Frida實現(xiàn)其功能,可以幫助廣大研究人員搜索和識別Windows可執(zhí)行程序中的常見安全漏洞以及功能。當前版本的WFH能夠自動識別動態(tài)鏈接庫DLL中潛在的側(cè)加載問題以及組件對象模型COM中劫持攻擊的實現(xiàn)可能。

DLL側(cè)加載利用勒Windows中WinSXS程序集來從SXS列表中加載惡意DLL文件。COM劫持將允許攻擊者置入惡意代碼,而這些代碼將能夠通過劫持COM引用和關(guān)系代替合法軟件的執(zhí)行。

WFH可以輸出潛在的安全漏洞,并將目標Windows可執(zhí)行文件中的潛在漏洞相關(guān)信息寫入至CSV文件中。

工具安裝

首先, 廣大研究人員需要使用下列命令將該項目源碼克隆至本地:

  1. git clone https://github.com/ConsciousHacker/WFH

然后運行下列命令安裝和配置相關(guān)依賴組件:

  1. pip install -r requirements.txt

工具幫助信息

  1. PS C:\Tools\WFH > python .\wfh.py -h

  2. usage: wfh.py [-h] -t T [T ...] -m {dll,com} [-v] [-timeout TIMEOUT]

  3.  

  4. Windows Feature Hunter

  5.  

  6. optional arguments:

  7.  -h, --help            show this help message and exit

  8.  -t T [T ...], -targets T [T ...]

  9.                        list of target windows executables

  10.  -m {dll,com}, -mode {dll,com}

  11.                        vulnerabilities to potentially identify

  12.  -v, -verbose          verbose output from Frida instrumentation

  13.  -timeout TIMEOUT      timeout value for Frida instrumentation

  14.  

  15. EXAMPLE USAGE

  16.    NOTE: It is recommended to copy target binaries to the same directory as wfh for identifying DLL Sideloading

  17.  

  18.    DLL Sideloading Identification (Single):        python wfh.py -t .\mspaint.exe -m dll

  19.    DLL Sideloading Identification (Verbose):       python wfh.py -t .\mspaint.exe -m dll -v

  20.    DLL Sideloading Identification (Timeout 30s):   python wfh.py -t .\mspaint.exe -m dll -timeout 30

  21.    DLL Sideloading Identification (Wildcard):      python wfh.py -t * -m dll

  22.    DLL Sideloading Identification (List):          python wfh.py -t .\mspaint.exe .\charmap.exe -m dll

  23.  

  24.    COM Hijacking Identification (Single):          python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com

  25.    COM Hijacking Identification (Verbose):         python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com -v

  26.    COM Hijacking Identification (Timeout 60s):     python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com -timeout 60

  27.    COM Hijacking Identification (Wildcard):        python wfh.py -t * -m com -v

  28. COM Hijacking Identification (List):            python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" "C:\Windows\System32\notepad.exe" -m com -v

工具使用

(1) DLL側(cè)加載識別

首先,我們需要將需要分析的代碼拷貝至WFH工具所在的目錄下,然后按照下列命令執(zhí)行掃描分析:

  1. PS C:\Tools\WFH > copy C:\Windows\System32\mspaint.exe .

  2. PS C:\Tools\WFH > copy C:\Windows\System32\charmap.exe .

  3. PS C:\Tools\WFH > dir

  4.  

  5.  

  6.    Directory: C:\Tools\WFH

  7.  

  8.  

  9. Mode                 LastWriteTime         Length Name

  10. ----                 -------------         ------ ----

  11. d-----         5/14/2021   2:12 PM                .vscode

  12. -a----          5/6/2021   2:39 PM           1928 .gitignore

  13. -a----         12/7/2019   2:09 AM         198656 charmap.exe

  14. -a----         5/18/2021   7:39 AM           6603 loadlibrary.js

  15. -a----          4/7/2021  12:48 PM         988160 mspaint.exe

  16. -a----         5/18/2021   7:53 AM           8705 README.md

  17. -a----         5/17/2021  11:27 AM           5948 registry.js

  18. -a----          5/6/2021   2:41 PM             11 requirements.txt

  19. -a----         5/18/2021   8:35 AM          10623 wfh.py

接下來,我們就可以使用WFH來對目標代碼進行分析,并嘗試識別其中的DLL側(cè)加載機會:

  1. PS C:\Tools\WFH > python .\wfh.py -t * -m dll

  2. ==================================================

  3. Running Frida against charmap.exe

  4. --------------------------------------------------

  5.        [+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL

  6.        [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE

  7.  

  8. [*] Writing raw Frida instrumentation to charmap.exe-raw.log

  9. [*] Writing Potential DLL Sideloading to charmap.exe-sideload.log

  10. --------------------------------------------------

  11. ==================================================

  12. Running Frida against mspaint.exe

  13. --------------------------------------------------

  14.        [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE

  15.        [-] Potential DllExport Sideloading: GetProcAddress,hModule : C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\gdiplus.dll, LPCSTR: GdiplusStartup

  16.        [+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL

  17.        [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE

  18.  

  19. [*] Writing raw Frida instrumentation to mspaint.exe-raw.log

  20. [*] Writing Potential DLL Sideloading to mspaint.exe-sideload.log

  21. --------------------------------------------------

  22. ==================================================

  23. [*] Writing dll results to dll_results.csv

  24.  

  25. PS C:\Tools\WFH > type .\dll_results.csv

  26. Executable,WinAPI,DLL,EntryPoint / WinAPI Args

  27. charmap.exe,LoadLibraryW,LPCWSTR: MSFTEDIT.DLL

  28. charmap.exe,LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE

  29. mspaint.exe,LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE

  30. mspaint.exe,GetProcAddress,hModule : C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\gdiplus.dll, LPCSTR: GdiplusStartup

  31. mspaint.exe,LoadLibraryW,LPCWSTR: MSFTEDIT.DLL

  32. mspaint.exe,LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE

如果你想讓WFH輸出更多詳細內(nèi)容,可以使用“-v”參數(shù)開啟Verbose模式。此時將能夠查看Windows API調(diào)用的詳細情況:

  1. PS C:\Tools\WFH > python .\wfh.py -t * -m dll -v

  2. ==================================================

  3. Running Frida against charmap.exe

  4. {'type': 'send', 'payload': 'LoadLibraryW,LPCWSTR: MSFTEDIT.DLL'}

  5. {'type': 'send', 'payload': 'LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE'}

  6. --------------------------------------------------

  7.        [+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL

  8.        [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE

  9.  

  10. [*] Writing raw Frida instrumentation to charmap.exe-raw.log

  11. [*] Writing Potential DLL Sideloading to charmap.exe-sideload.log

  12. --------------------------------------------------

  13. ==================================================

  14. Running Frida against mspaint.exe

  15. {'type': 'send', 'payload': 'LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE'}

  16. {'type': 'send', 'payload': 'GetProcAddress,hModule : C:\\WINDOWS\\WinSxS\\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\\gdiplus.dll, LPCSTR: GdiplusStartup'}

  17. {'type': 'send', 'payload': 'LoadLibraryW,LPCWSTR: MSFTEDIT.DLL'}

  18. {'type': 'send', 'payload': 'LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE'}

  19. --------------------------------------------------

  20.        [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE

  21.        [-] Potential DllExport Sideloading: GetProcAddress,hModule : C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\gdiplus.dll, LPCSTR: GdiplusStartup

  22.        [+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL

  23.        [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE

  24.  

  25. [*] Writing raw Frida instrumentation to mspaint.exe-raw.log

  26. [*] Writing Potential DLL Sideloading to mspaint.exe-sideload.log

  27. --------------------------------------------------

  28. ==================================================

  29. [*] Writing dll results to dll_results.csv

(2) COM劫持識別

  1. PS C:\Tools\WFH > python .\wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com

  2. ==================================================

  3. Running Frida against C:\Program Files\Internet Explorer\iexplore.exe

  4. --------------------------------------------------

  5.        [+] Potential COM Hijack: Path : HKEY_LOCAL_MACHINE\Software\Classes\CLSID\{0E5AAE11-A475-4C5B-AB00-C66DE400274E}\InProcServer*32,lpValueName : null,Type : REG_EXPAND_SZ, Value : %SystemRoot%\system32\Windows.Storage.dll

  6.        [+] Potential COM Hijack: Path : HKEY_CLASSES_ROOT\CLSID\{1FD49718-1D00-4B19-AF5F-070AF6D5D54C}\InProcServer*32,lpValueName : null,Type : REG_SZ, Value : C:\Program Files (x86)\Microsoft\Edge\Application\90.0.818.62\BHO\ie_to_edge_bho_64.dll

  7.  

  8. [*] Writing raw Frida instrumentation to .\iexplore.exe-raw.log

  9. [*] Writing Potential COM Hijack to .\iexplore.exe-comhijack.log

  10. --------------------------------------------------

  11. ==================================================

  12. [*] Writing dll results to comhijack_results.csv

工具使用樣例

(1) 原生Windows簽名代碼

將所有的原生Windows簽名代碼拷貝至WFH腳本所在目錄:

  1. Get-ChildItem c:\ -File | ForEach-Object { if($_ -match '.+?exe$') {Get-AuthenticodeSignature $_.fullname} } | where {$_.IsOSBinary} | ForEach-Object {Copy-Item $_.path . }

(2) 搜索DLL側(cè)加載機會

  1. python wfh.py -t * -m dll

(3) 搜索COM劫持機會

  1. python wfh.py -t * -m com


】【打印關(guān)閉】 【返回頂部
分享到QQ空間
分享到: 
上一篇【漏洞預警】Fortinet 8月多個安.. 下一篇云安全:數(shù)據(jù)庫權(quán)限的分配與回收

立足首都,輻射全球,防御吧專注云防御及云計算服務15年!

聯(lián)系我們

服務熱線:13051179500 18910191973
企業(yè)QQ:1245940436
技術(shù)支持:010-56159998
E-Mail:xihedata.com
Copyright ? 2003-2016 fangyuba. 防御吧(完美解決防御與加速) 版權(quán)所有 增值許可:京B2-20140042號
售前咨詢
公司總機:18910191973
24小時電話:010-56159998
投訴電話:18910191973
值班售后/技術(shù)支持
售后服務/財務
備案專員
緊急電話:18610088800