自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

如何使用WFH搜索Windows可執(zhí)行程序中的常見(jiàn)漏洞或功能

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

關(guān)于WFH

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

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

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

工具安裝

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

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

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

  1. pip install -r requirements.txt 

工具幫助信息

  1. PS C:\Tools\WFH > python .\wfh.py -h 
  2.  
  3. usage: wfh.py [-h] -t T [T ...] -m {dll,com} [-v] [-timeout TIMEOUT] 
  4.  
  5.   
  6.  
  7. Windows Feature Hunter 
  8.  
  9.   
  10.  
  11. optional arguments: 
  12.  
  13.   -h, --help            show this help message and exit 
  14.  
  15.   -t T [T ...], -targets T [T ...] 
  16.  
  17.                         list of target windows executables 
  18.  
  19.   -m {dll,com}, -mode {dll,com} 
  20.  
  21.                         vulnerabilities to potentially identify 
  22.  
  23.   -v, -verbose          verbose output from Frida instrumentation 
  24.  
  25.   -timeout TIMEOUT      timeout value for Frida instrumentation 
  26.  
  27.   
  28.  
  29. EXAMPLE USAGE 
  30.  
  31.     NOTE: It is recommended to copy target binaries to the same directory as wfh for identifying DLL Sideloading 
  32.  
  33.   
  34.  
  35.     DLL Sideloading Identification (Single):        python wfh.py -t .\mspaint.exe -m dll 
  36.  
  37.     DLL Sideloading Identification (Verbose):       python wfh.py -t .\mspaint.exe -m dll -v 
  38.  
  39.     DLL Sideloading Identification (Timeout 30s):   python wfh.py -t .\mspaint.exe -m dll -timeout 30 
  40.  
  41.     DLL Sideloading Identification (Wildcard):      python wfh.py -t * -m dll 
  42.  
  43.     DLL Sideloading Identification (List):          python wfh.py -t .\mspaint.exe .\charmap.exe -m dll 
  44.  
  45.   
  46.  
  47.     COM Hijacking Identification (Single):          python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com 
  48.  
  49.     COM Hijacking Identification (Verbose):         python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com -v 
  50.  
  51.     COM Hijacking Identification (Timeout 60s):     python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com -timeout 60 
  52.  
  53.     COM Hijacking Identification (Wildcard):        python wfh.py -t * -m com -v 
  54.  
  55. 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è)加載識(shí)別

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

  1. PS C:\Tools\WFH > copy C:\Windows\System32\mspaint.exe . 
  2.  
  3. PS C:\Tools\WFH > copy C:\Windows\System32\charmap.exe . 
  4.  
  5. PS C:\Tools\WFH > dir 
  6.  
  7.   
  8.  
  9.   
  10.  
  11.     Directory: C:\Tools\WFH 
  12.  
  13.   
  14.  
  15.   
  16.  
  17. Mode                 LastWriteTime         Length Name 
  18.  
  19. ----                 -------------         ------ ---- 
  20.  
  21. d-----         5/14/2021   2:12 PM                .vscode 
  22.  
  23. -a----          5/6/2021   2:39 PM           1928 .gitignore 
  24.  
  25. -a----         12/7/2019   2:09 AM         198656 charmap.exe 
  26.  
  27. -a----         5/18/2021   7:39 AM           6603 loadlibrary.js 
  28.  
  29. -a----          4/7/2021  12:48 PM         988160 mspaint.exe 
  30.  
  31. -a----         5/18/2021   7:53 AM           8705 README.md 
  32.  
  33. -a----         5/17/2021  11:27 AM           5948 registry.js 
  34.  
  35. -a----          5/6/2021   2:41 PM             11 requirements.txt 
  36.  
  37. -a----         5/18/2021   8:35 AM          10623 wfh.py 

接下來(lái),我們就可以使用WFH來(lái)對(duì)目標(biāo)代碼進(jìn)行分析,并嘗試識(shí)別其中的DLL側(cè)加載機(jī)會(huì):

  1. PS C:\Tools\WFH > python .\wfh.py -t * -m dll 
  2.  
  3. ================================================== 
  4.  
  5. Running Frida against charmap.exe 
  6.  
  7. -------------------------------------------------- 
  8.  
  9.         [+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL 
  10.  
  11.         [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE 
  12.  
  13.   
  14.  
  15. [*] Writing raw Frida instrumentation to charmap.exe-raw.log 
  16.  
  17. [*] Writing Potential DLL Sideloading to charmap.exe-sideload.log 
  18.  
  19. -------------------------------------------------- 
  20.  
  21. ================================================== 
  22.  
  23. Running Frida against mspaint.exe 
  24.  
  25. -------------------------------------------------- 
  26.  
  27.         [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE 
  28.  
  29.         [-] Potential DllExport Sideloading: GetProcAddress,hModule : C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\gdiplus.dll, LPCSTR: GdiplusStartup 
  30.  
  31.         [+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL 
  32.  
  33.         [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE 
  34.  
  35.   
  36.  
  37. [*] Writing raw Frida instrumentation to mspaint.exe-raw.log 
  38.  
  39. [*] Writing Potential DLL Sideloading to mspaint.exe-sideload.log 
  40.  
  41. -------------------------------------------------- 
  42.  
  43. ================================================== 
  44.  
  45. [*] Writing dll results to dll_results.csv 
  46.  
  47.   
  48.  
  49. PS C:\Tools\WFH > type .\dll_results.csv 
  50.  
  51. Executable,WinAPI,DLL,EntryPoint / WinAPI Args 
  52.  
  53. charmap.exe,LoadLibraryW,LPCWSTR: MSFTEDIT.DLL 
  54.  
  55. charmap.exe,LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE 
  56.  
  57. mspaint.exe,LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE 
  58.  
  59. mspaint.exe,GetProcAddress,hModule : C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\gdiplus.dll, LPCSTR: GdiplusStartup 
  60.  
  61. mspaint.exe,LoadLibraryW,LPCWSTR: MSFTEDIT.DLL 
  62.  
  63. mspaint.exe,LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE 

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

  1. PS C:\Tools\WFH > python .\wfh.py -t * -m dll -v 
  2.  
  3. ================================================== 
  4.  
  5. Running Frida against charmap.exe 
  6.  
  7. {'type': 'send', 'payload': 'LoadLibraryW,LPCWSTR: MSFTEDIT.DLL'} 
  8.  
  9. {'type': 'send', 'payload': 'LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE'} 
  10.  
  11. -------------------------------------------------- 
  12.  
  13.         [+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL 
  14.  
  15.         [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE 
  16.  
  17.   
  18.  
  19. [*] Writing raw Frida instrumentation to charmap.exe-raw.log 
  20.  
  21. [*] Writing Potential DLL Sideloading to charmap.exe-sideload.log 
  22.  
  23. -------------------------------------------------- 
  24.  
  25. ================================================== 
  26.  
  27. Running Frida against mspaint.exe 
  28.  
  29. {'type': 'send', 'payload': 'LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE'} 
  30.  
  31. {'type': 'send', 'payload': 'GetProcAddress,hModule : C:\\WINDOWS\\WinSxS\\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\\gdiplus.dll, LPCSTR: GdiplusStartup'} 
  32.  
  33. {'type': 'send', 'payload': 'LoadLibraryW,LPCWSTR: MSFTEDIT.DLL'} 
  34.  
  35. {'type': 'send', 'payload': 'LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE'} 
  36.  
  37. -------------------------------------------------- 
  38.  
  39.         [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE 
  40.  
  41.         [-] Potential DllExport Sideloading: GetProcAddress,hModule : C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\gdiplus.dll, LPCSTR: GdiplusStartup 
  42.  
  43.         [+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL 
  44.  
  45.         [+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE 
  46.  
  47.   
  48.  
  49. [*] Writing raw Frida instrumentation to mspaint.exe-raw.log 
  50.  
  51. [*] Writing Potential DLL Sideloading to mspaint.exe-sideload.log 
  52.  
  53. -------------------------------------------------- 
  54.  
  55. ================================================== 
  56.  
  57. [*] Writing dll results to dll_results.csv 

(2) COM劫持識(shí)別

  1. PS C:\Tools\WFH > python .\wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com 
  2.  
  3. ================================================== 
  4.  
  5. Running Frida against C:\Program Files\Internet Explorer\iexplore.exe 
  6.  
  7. -------------------------------------------------- 
  8.  
  9.         [+] 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 
  10.  
  11.         [+] 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 
  12.  
  13.   
  14.  
  15. [*] Writing raw Frida instrumentation to .\iexplore.exe-raw.log 
  16.  
  17. [*] Writing Potential COM Hijack to .\iexplore.exe-comhijack.log 
  18.  
  19. -------------------------------------------------- 
  20.  
  21. ================================================== 
  22.  
  23. [*] 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è)加載機(jī)會(huì)

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

(3) 搜索COM劫持機(jī)會(huì)

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

項(xiàng)目地址

WFH:【GitHub傳送門(mén)

 

責(zé)任編輯:趙寧寧 來(lái)源: FreeBuf
相關(guān)推薦

2010-03-23 10:29:28

Python程序編譯轉(zhuǎn)

2010-03-26 14:49:04

Python腳本

2022-06-17 07:57:53

攔截包裝軟鏈接

2009-09-04 09:36:17

Java調(diào)用

2024-03-08 09:34:35

JpackageJarJava

2013-03-18 09:48:05

微軟Windows Blu

2018-10-29 10:13:29

Windows 10應(yīng)用程序卸載

2019-08-23 17:33:02

WindowsWindows 10電腦

2021-12-26 07:43:50

aDLLDLL漏洞

2022-01-11 09:59:23

Python關(guān)機(jī)程序文件

2019-05-29 18:35:04

Windows 10Office 365應(yīng)用程序

2018-12-21 19:30:28

Windows 10Windows管理員身份

2022-02-04 22:05:19

JVM程序內(nèi)存模型

2021-10-08 10:05:31

DorkifyGoogle Dork漏洞

2023-11-06 14:21:43

2010-10-13 13:46:10

2021-09-29 13:24:50

惡意文件Windows加載器

2010-02-24 15:41:53

Python解釋器

2011-08-17 15:39:16

Windows7管理員身份運(yùn)行程序

2021-02-07 10:22:06

Windows 10Windows微軟
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)