[German]Many users are knowing 7-Zip as a tool for unpacking archive files. The software is free of charge and is also available in a portable version for Windows. In addition, 7-Zip is also used in various products. Funny world? Unfortunately, there is a dark side of 7-Zip, because the tool is potentially a huge security risk. Here are some hints about what you should know – and a final piece of advice.
The problem with packers like 7-Zip
The core function of a program such as 7-Zip is unpacking of archive files, whereby various formats are to be supported. 7-Zip is quite good for that. The following figure shows the supported formats that can be associated to 7-Zip.
Unfortunately, there is a problem with this function: The content of the archive files to be unpacked (i. e. malware) could exploit vulnerabilities in 7-Zip & Co. to extract and execute malicious code. For this purpose, memory overflows must be provoked during unpacking, which can possibly be misused to execute the code. Or, to put it another way: The user tries to unpack a file, and a malware contained in the file becomes active and manipulates the files accessible under the user account. This is something no user expects from 7-Zip, but it is not unrealistic.
7-Zip and vulnerabilities
7-Zip is developed by Igor Pavlov and made available free of charge. That’s generous, so it isn’t easy to criticize. Unfortunately, security vulnerabilities in 7-Zip and the subordinate libraries with packing functions are found again and again. I recently posted the article
7-Zip vulnerable – update to version 18.01 about vulnerabilities in this tool and recommended an update to version 18.0 and higher. Igor Pavlov had reacted quickly after discovering the vulnerabilities and provided version 18.01 of 7-Zip. So far so good.
However, there are some scenarios where older versions of 7-Zip are used. And even third-party providers sometimes use 7-Zip (or sub-functions) in their programs. There older versions of the libraries or the program could be installed or updated on the system (without the user`s knowledge).
This would be the’ first thorn’ in terms of security, although many users there, admittedly, are not aware of any of the dilemma’ 7-Zip variant with security vulnerabilities working on my system’ or have little or no influence on this issue.
If you need to use older, vulnerable 7-zip variants (why ever) on your system, you could fix the vulnerabilities CVE-2017-17969 and CVE-2018-5996 with micro-patches from 0patch.com (see their blog post). In the following consideration, however, I exclude this scenario because of its complexity.
Why 7-Zip puts you at risk
Let’s get to the beef of this article. The developer of this tool refuse to hardening its software against unknown security vulnerabilities. To harden software with respect to the exploitability of unknown vulnerabilities, developers can specify different options when linking modules to an executable binary file. This Microsoft document introduces two such options for improving application security. There are other techniques (like compiler options to check for buffer overflow in executable code) of this kind, some of which have been known for many years.
Igor Patchev refuses since years to link 7-Zip binary files with the options /NXCOMPAT and /DYNAMICBASE. This means that 7-Zip runs on all Windows systems without ASLR. And DEP is enabled only on 64-bit Windows 7 systems and in the 32-bit version of Windows 10.
This has been described in landave’s blog – and the image posted above shows, that DEP is deactivated permanently. The author of the linked blog post writes, that 7-Zip was compiled also without the /GS flag. So there are no checks for stack overflows. Beside the article in in landave’s blog I know from another trustable security researcher, that Igor Pavlov has been informed about that potential security risks. Here is a zite from landave’s blog post:
I have discussed this issue with Igor Pavlov and tried to convince him to enable all three flags. However, he refused to enable
/DYNAMICBASEbecause he prefers to ship the binaries without relocation table to achieve a minimal binary size. Moreover, he doesn’t want to enable
/GS, because it could affect the runtime as well as the binary size. At least he will try to enable
/NXCOMPATfor the next release. Apparently, it is currently not enabled because 7-Zip is linked with an obsolete linker that doesn’t support the flag.
And there’s a problem with this: 7-Zip is free of charge, but its author uses outdated development tools and wants to save a few bytes in the program file at the expense of security. This leaves me with at this point to the recommendation, to avoid using this tool – until it’s hardened against attacks to unknown vulnerabilities.