Oct 26 2023 |
CVE-2023–4632: Local Privilege Escalation in Lenovo System Updater
Version: Lenovo Updater Version <= 5.08.01.0009
Operating System Tested On: Windows 10 22H2 (x64)
Vulnerability: Lenovo System Updater Local Privilege Escalation via Arbitrary File Write
Advisory: https://support.lenovo.com/us/en/product_security/LEN-135367
Vulnerability Overview
The Lenovo System Update application is designed to allow non-administrators to check for and apply updates to their workstation. During the process of checking for updates, the privileged Lenovo Update application attempts to utilize C:SSClientCommonHelloLevel_9_58_00.xml, which doesn’t exist on the filesystem. Due to the ability for any low-privileged user to create a directory in the root of the C: drive, it’s possible to provide the privileged Lenovo System Update application a specially crafted HelloLevel_9_58_00.xml file, which is located in C:SSClientCommon. This custom XML file contains a source and destination file path, which the Lenovo System Update application parses when the user checks for updates. Once parsed, the privileged Lenovo System Update application moves the source file to the destination location and allows for an arbitrary file write primitive, thus resulting in elevation of privilege to NT AUTHORITYSYSTEM.
Vulnerability Walkthrough
When a user checks for Lenovo updates via the Lenovo System Update application, Tvsukernel.exe is launched as the user Lenovo_tmp_<randomCharacters> in a privileged, High Integrity context. Upon execution, Tvsukernel.exe checks for HelloLevel_9_58_00.xml in C:SSClientCommon, shown below in Figure 01:
By default, all versions of Windows allow for low-privileged users to create directories within the root of the C: drive. An attacker can manually create the directory C:SSClientCommon and then place HelloLevel_9_58_00.xml within it, as shown below in Figure 02:
After C:SSClientCommon is created, an attacker can then create the required subdirectory C:SSClientCommonUTS, which will contain the attacker’s malicious binary. The directory structure for the attack looks similar to Figure 03 below:
Since HelloLevel_9_58_00.xml resides in a location that an attacker can control, it is possible to craft a custom XML file that allows an attacker to move a file from one location to another. This is possible because the custom XML defines an “execute” action, providing a “Source” and “Destination” path. The “SourcePath” element defines a portable executable (PE) file located within C:SSClientCommonUTS–in this case, C:SSClientCommonUTSpoc2.exe.
The “DestinationPath” node defines the location in which the source file is to be copied to, shown below in Figure 04:
After the Lenovo System Update application launches and checks for updates, the privileged process (i.e., Tvsukernel.exe) checks to see whether C:SSClientCommonHelloLevel_9_58_00.xml exists. Since the path has been created and a custom XML file planted, Tvsukernel.exe will move the custom HelloLevel_9_58_00.xml file to C:ProgramDataLenovoSystemUpdatesessionSEsystemSSClientCommonHelloLevel_9_58_00.xml, shown below in Figure 05:
Once the XML file is moved, Tvsukernel.exe calls the ParseUDF() function within Client.dll in order to parse the XML file located in C:ProgramDataLenovoSystemUpdatesessionSEsystemSSClientCommonHelloLevel_9_58_00.xml. When Tvsukernel.exe parses the XML, it prepends the DestinationPath contained in the XML with C:ProgramDataLenovoSystemUpdatesessionSE, shown below in Figure 06:
In the custom attacker-controlled XML file, it is possible to use directory traversal to break out of the replaced C:ProgramDataLenovoSystemUpdatesessionSE DestinationPath value. An attacker can leverage this to choose any location on the operating system, thus resulting in an arbitrary file write primitive. In this case, directory traversal was used to set the DestinationPath value to C:Program Files (x86)LenovoSystem UpdateSUService.exe, shown below in Figure 07. This is due to the fact that the Lenovo Updater tries to launch this application as NT AUTHORITYSYSTEM each time the Lenovo System Updater is launched.
With the custom XML created and placed in C:SSClientCommonHelloLevel_9_58_00.xml and a malicious binary placed in C:SSClientCommonUTSpoc2.exe, an attacker can simply open the Lenovo System Update application and check for updates. Upon execution, Tvsukernel.exe will move the malicious C:SSClientCommonHelloLevel_9_58_00.xml to C:ProgramDataLenovoSystemUpdatesessionSEsystemSSClientCommonHelloLevel_9_58_00.xml, parse it, and then move C:SSClientCommonUTSpoc2.exe to C:Program Files (x86)LenovoSystem UpdateSUService.exe; overwriting the SUService.exe binary, shown below in Figure 08:
With Lenovo’s SUService.exe binary overwritten with a custom application, an attacker can close and re-open the Lenovo System Update application, which will cause the attacker’s application to execute as NT AUTHORITYSYSTEM. In this case, poc2.exe gets the username of the currently executing user and writes it out to C:WindowsPOCOutput.txt, shown below in Figure 09:
This vulnerability has been fixed in the latest version of the Lenovo System Updater application.
Lenovo’s Advisory can be found here: https://support.lenovo.com/us/en/product_security/LEN-135367
CVE-2023–4632: Local Privilege Escalation in Lenovo System Updater was originally published in Posts By SpecterOps Team Members on Medium, where people are continuing the conversation by highlighting and responding to this story.