7-Zip 16 DLL Hijacking

2022.04.22
Risk: Medium
Local: Yes
Remote: No
CVE: N/A
CWE: N/A

Microsoft Windows Environment Variable Expansion Issue Leads To Remote DLL Hijack Attack vector: 7-ZIP v.16 7-ZIP v.16 and possibly other softwares that utilizes the HTML Help System are prone to a remote DLL hijacking issue which leads to arbitrary code execution. PoC attached. because the OS fails to expand the "%systemroot%" environment variable and additionally an unsafe search for hhctrl.ocx when the program invokes "HtmlHelp()" to load the HTML Help system so if the current working directory of the program is set to an attacker controlled location such as WebDAV/SMB shares and the path '.\%systemroot%\system32\hhctrl.ocx' exists, it will be loaded instead of the legit 'hhctrl.ocx' due to unsafe search order. This allows for arbitrary code execution. Note: "Notepad.exe" app imported from Windows XP SP3 into a Windows 7/8/10 OS is also vulnerable. Vulnerable Windows versions: 7 / 8.1 / 10 depending on the patch level. Patches up to November 2015 on 8.1 and 10 v.1511 is vulnerable. Windows 8.1 patches up to January 2020 is assumed vulnerable Windows 7, fully patched as of January 2020 is vulnerable. A C (not C++, C# etc) DLL must be created and contain the "DllMain()" fuction which you can use to run arbitrary code. then create a subdirectory on the WebDAV/SMB share called '7z', then create the tree: '.\%systemroot%\system32' and place the DLL named 'hhctrl.ocx' on the 'system32' folder. Place a valid ZIP / 7Z archive on '7z' folder and send the UNC path / link to the target. The target accesses the remote share via Windows Explorer (File Explorer) and opens the archive (with 7-ZIP) then proceeds to click "Help" then "Contents (F1)" or pressing "F1" key to trigger the vulnerability and run arbitrary code. exploit complexity: "easy" reliability: 100% severity: medium Video demo on: https://www.youtube.com/watch?v=_muAPMzd9T0


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2024, cxsecurity.com

 

Back to Top