
Frida-आधारित गतिशील विश्लेषण उपकरण जो Windows एक्ज़ीक्यूटेबल्स में DLL साइडलोडिंग और COM हाइजैकिंग कमजोरियों को रनटाइम इंस्ट्रुमेंटेशन और IAT पार्सिंग के माध्यम से स्वचालित रूप से पहचानता है।
विंडोज फीचर हंटर (WFH) एक प्रूफ ऑफ कॉन्सेप्ट पायथन स्क्रिप्ट है जो फ्रिडा (Frida) का उपयोग करती है, जो एक डायनेमिक इंस्ट्रूमेंटेशन टूलकिट है, ताकि विंडोज निष्पादन योग्य फाइलों में सामान्य "कमजोरियों" या "सुविधाओं" की पहचान करने में सहायता मिल सके। WFH वर्तमान में बड़े पैमाने पर संभावित डायनेमिक लिंक्ड लाइब्रेरी (DLL) साइडलोडिंग और कंपोनेंट ऑब्जेक्ट मॉडल (COM) हाईजैकिंग के अवसरों को स्वचालित रूप से पहचानने की क्षमता रखता है।
DLL साइडलोडिंग विंडोज साइड-बाय-साइड (WinSXS) असेंबली का उपयोग करके साइड-बाय-साइड (SXS) सूची से एक दुर्भावनापूर्ण DLL लोड करता है। COM हाईजैकिंग एक प्रतिद्वंद्वी को COM संदर्भों और संबंधों को हाईजैक करके वैध सॉफ्टवेयर के स्थान पर निष्पादित होने वाले दुर्भावनापूर्ण कोड को सम्मिलित करने की अनुमति देता है। WFH संभावित कमजोरियों को प्रिंट करेगा और लक्ष्य विंडोज निष्पादन योग्य फाइलों में संभावित कमजोरियों वाली एक CSV फ़ाइल लिखेगा।
pip install -r requirements.txt
PS C:\Tools\WFH > python .\wfh.py -h
usage: wfh.py [-h] -t T [T ...] -m {dll,com} [-v] [-timeout TIMEOUT]
Windows Feature Hunter
optional arguments:
-h, --help show this help message and exit
-t T [T ...], -targets T [T ...]
list of target windows executables
-m {dll,com}, -mode {dll,com}
vulnerabilities to potentially identify
-v, -verbose verbose output from Frida instrumentation
-timeout TIMEOUT timeout value for Frida instrumentation
EXAMPLE USAGE
NOTE: It is recommended to copy target binaries to the same directory as wfh for identifying DLL Sideloading
DLL Sideloading Identification (Single): python wfh.py -t .\mspaint.exe -m dll
DLL Sideloading Identification (Verbose): python wfh.py -t .\mspaint.exe -m dll -v
DLL Sideloading Identification (Timeout 30s): python wfh.py -t .\mspaint.exe -m dll -timeout 30
DLL Sideloading Identification (Wildcard): python wfh.py -t * -m dll
DLL Sideloading Identification (List): python wfh.py -t .\mspaint.exe .\charmap.exe -m dll
COM Hijacking Identification (Single): python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com
COM Hijacking Identification (Verbose): python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com -v
COM Hijacking Identification (Timeout 60s): python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" -m com -timeout 60
COM Hijacking Identification (Wildcard): python wfh.py -t * -m com -v
COM Hijacking Identification (List): python wfh.py -t "C:\Program Files\Internet Explorer\iexplore.exe" "C:\Windows\System32\notepad.exe" -m com -v
पहले आपको उन बाइनरीज़ को कॉपी करना होगा जिनका आप विश्लेषण करना चाहते हैं, WFH के समान निर्देशिका में
PS C:\Tools\WFH > copy C:\Windows\System32\mspaint.exe .
PS C:\Tools\WFH > copy C:\Windows\System32\charmap.exe .
PS C:\Tools\WFH > dir
Directory: C:\Tools\WFH
Mode LastWriteTime Length Name
---- ------------- ------ ----
d----- 5/14/2021 2:12 PM .vscode
-a---- 5/6/2021 2:39 PM 1928 .gitignore
-a---- 12/7/2019 2:09 AM 198656 charmap.exe
-a---- 5/18/2021 7:39 AM 6603 loadlibrary.js
-a---- 4/7/2021 12:48 PM 988160 mspaint.exe
-a---- 5/18/2021 7:53 AM 8705 README.md
-a---- 5/17/2021 11:27 AM 5948 registry.js
-a---- 5/6/2021 2:41 PM 11 requirements.txt
-a---- 5/18/2021 8:35 AM 10623 wfh.py
अब आप DLL साइडलोडिंग के अवसरों की पहचान करने के लिए wfh को बाइनरीज़ पर चला सकते हैं
PS C:\Tools\WFH > python .\wfh.py -t * -m dll
==================================================
Running Frida against charmap.exe
--------------------------------------------------
[+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL
[+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE
[*] Writing raw Frida instrumentation to charmap.exe-raw.log
[*] Writing Potential DLL Sideloading to charmap.exe-sideload.log
--------------------------------------------------
==================================================
Running Frida against mspaint.exe
--------------------------------------------------
[+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE
[-] Potential DllExport Sideloading: GetProcAddress,hModule : C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\gdiplus.dll, LPCSTR: GdiplusStartup
[+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL
[+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE
[*] Writing raw Frida instrumentation to mspaint.exe-raw.log
[*] Writing Potential DLL Sideloading to mspaint.exe-sideload.log
--------------------------------------------------
==================================================
[*] Writing dll results to dll_results.csv
PS C:\Tools\WFH > type .\dll_results.csv
Executable,WinAPI,DLL,EntryPoint / WinAPI Args
charmap.exe,LoadLibraryW,LPCWSTR: MSFTEDIT.DLL
charmap.exe,LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE
mspaint.exe,LoadLibraryExW,LPCWSTR : gdiplus.dll, dwFlags : NONE
mspaint.exe,GetProcAddress,hModule : C:\WINDOWS\WinSxS\amd64_microsoft.windows.gdiplus_6595b64144ccf1df_1.1.19041.789_none_faf0a7e97612e7bb\gdiplus.dll, LPCSTR: GdiplusStartup
mspaint.exe,LoadLibraryW,LPCWSTR: MSFTEDIT.DLL
mspaint.exe,LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE
यदि आप अधिक विस्तृत आउटपुट पसंद करते हैं, तो आप "-v" का उपयोग कर सकते हैं ताकि Frida द्वारा Windows API कॉल को इंस्ट्रूमेंट करने का हर संदेश देख सकें। आप इस आउटपुट को रॉ लॉग फ़ाइल में भी देख सकते हैं।
PS C:\Tools\WFH > python .\wfh.py -t * -m dll -v
==================================================
Running Frida against charmap.exe
{'type': 'send', 'payload': 'LoadLibraryW,LPCWSTR: MSFTEDIT.DLL'}
{'type': 'send', 'payload': 'LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE'}
--------------------------------------------------
[+] Potential DllMain Sideloading: LoadLibraryW,LPCWSTR: MSFTEDIT.DLL
[+] Potential DllMain Sideloading: LoadLibraryExW,LPCWSTR : MSFTEDIT.DLL, dwFlags : NONE