如何使用WFH搜索Windows可执行程序中的常见漏洞或功能

关于WFH

WFH,全名为Windows Feature Hunter,即Windows功能搜索工具,该工具基于Python开发,使用Frida实现其功能,可以帮助广大研究人员搜索和识别Windows可执行程序中的常见安全漏洞以及功能。当前版本的WFH能够自动识别动态链接库DLL中潜在的侧加载问题以及组件对象模型COM中劫持攻击的实现可能。

DLL侧加载利用勒Windows中WinSXS程序集来从SXS列表中加载恶意DLL文件。COM劫持将允许攻击者置入恶意代码,而这些代码将能够通过劫持COM引用和关系代替合法软件的执行。

WFH可以输出潜在的安全漏洞,并将目标Windows可执行文件中的潜在漏洞相关信息写入至CSV文件中。

工具安装

首先, 广大研究人员需要使用下列命令将该项目源码克隆至本地:

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

然后运行下列命令安装和配置相关依赖组件:

  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侧加载识别

首先,我们需要将需要分析的代码拷贝至WFH工具所在的目录下,然后按照下列命令执行扫描分析:

  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 

接下来,我们就可以使用WFH来对目标代码进行分析,并尝试识别其中的DLL侧加载机会:

  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 

如果你想让WFH输出更多详细内容,可以使用“-v”参数开启Verbose模式。此时将能够查看Windows API调用的详细情况:

  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劫持识别

  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侧加载机会

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

(3) 搜索COM劫持机会

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

项目地址

WFH:【GitHub传送门

 

文章来源网络,作者:管理,如若转载,请注明出处:https://shuyeidc.com/wp/143282.html<

(0)
管理的头像管理
上一篇2025-03-09 15:16
下一篇 2025-03-09 15:17

相关推荐

  • 站群服务器和普通服务器到底哪个更适合GEO,怎么选?

    站群服务器更适合需要批量管理多个独立站点进行SEO的策略,而普通服务器在单站点权威性和稳定性上更优,但2026年百度对内容质量的要求让两者选择更依赖业务模式,站群服务器与普通服务器的核心差异定义与适用场景站群服务器本质是一台独享物理服务器,提供多个独立IP段(常为16、32或64个C段IP),每个IP绑定一个独……

    2026-07-28
    0
  • 物理服务器和云服务器做站群到底选哪个,哪个更稳定?

    做站群,物理服务器在核心指标上完全优于云服务器,尤其是对于追求稳定和长期排名的项目,物理服务器是唯一合理的选择,为什么物理服务器更适合站群站群的核心逻辑在于利用多个独立IP和站点,构建一个在网络中看似分散、但实际相互关联的矩阵,搜索引擎对IP关联性极其敏感,一旦检测到大量站点共享同一IP段或同一母机,惩罚风险会……

    2026-07-28
    0
  • 国内高防服务器哪家防御真实靠谱,怎么选?

    国内高防服务器哪家防御真实靠谱?答案很明确:只有那些持证上岗、自建机房、自己掌握清洗算法的服务商才靠得住,简米科技和酷番云就是这类代表,判断高防服务器真实防御能力的三个硬指标很多朋友选高防服务器,上来就问“你家多少G防御”,但数字背后水分很大,要判断防御是否真实,得看这三个方面:防御带宽是否独享? 有些服务商宣……

    2026-07-28
    0
  • 裸金属服务器和物理服务器有什么区别?,怎么选?

    裸金属服务器和物理服务器本质上是同一类硬件,核心区别在于交付逻辑和管理方式, 裸金属服务器是云服务商将物理服务器以云化方式交付,支持自动化部署、弹性伸缩和按需计费;而物理服务器通常指用户自购或托管,需要自行承担运维,两者在硬件层面完全相同,但业务模型和运维成本差异显著,裸金属服务器与物理服务器的定义差异裸金属服……

    2026-07-28
    0
  • 做GEO站群选哪家服务器服务商靠谱,怎么选?

    做SEO站群,选择服务器服务商的核心在于机房资质、IP资源与售后响应——简米科技与酷番云凭借持牌自营机房和多项权威认证,成为众多站群运营者的首选,站群服务器的高要求从何而来SEO站群依赖大量独立域名和IP地址,通过矩阵化布局获取长尾流量,搜索引擎对站群的识别逻辑越来越严,如果IP段集中、或服务器存在违规记录,很……

    2026-07-28
    0

发表回复

您的邮箱地址不会被公开。必填项已用 * 标注