This is a really simple security flaw which allows any authenticated user to have READ permissions over the entire Windows registry, therefore having access to sensitive information, such as the one contained within both SAM and SECURITY hives
As is well known, those sensitive files are locked out by the system, so even if there is a DACL misconfiguration that grants READ privileges to the BUILTIN\Users group, they can be read
However, an operator could leverage the VSS Volume Shadow Copy ( System Protection ) in order to retrieve a copy of those files and then proceed with an offline data extraction
The CVE-2020-0668 corresponds to a security flaw in the Windows Service Tracing that can be leveraged to perform a privileged file move or rename operation carried out by LOCAL SYSTEM
This vulnerability alone does not allow an operator to gain code execution as LOCAL SYSTEM. However, we can chain it with another security flaw, misconfiguration or attack vector to achieve system compromise
In this case, we can look for any existing service in the given system that runs as LOCAL SYSTEM and for which an non-privileged user has the permissions to restart it. Therefore, we can leverage CVE-2020-0668 to replace the defined executable in the binPath property of the service in question
So first, we use CVE-2020-0668 to give us FULL CONTROL over the service’s executable by replacing the legitimate binary with a binary we upload to the target previously
Since we have FULL CONTROL over it, now we have permissions to replace that binary with another malicious binary, so when we restart the service, we will gain code execution as LOCAL SYSTEM
Requirements
The Windows target must be vulnerable to CVE-2020-0668
Windows 10 build ( 1607, 1709, 1803, 1809, 1903 and 1909 ) and lower ( e.g. W7, W8.1, WS{2008, 2012, 2016}
The controlled user account must be able to restart the service running as LOCAL SYSTEM
Abuse - Windows
Listing system services for which the current user has WRITE privileges
First, we must look for any system service for which our current user has the following rights
Since our binary will become obsolete and non-functional after running the exploit below, we need to make a copy of it so we can replace it with that copy when we get FULL CONTROL
[+] Moving C:\Windows\Temp\LPE\rev.exe to C:\Program Files (x86)\Mozilla Maintenance Service\maintenanceservice.exe[+] Mounting \RPC Control onto C:\Users\htb-student\AppData\Local\Temp\rlhdx1of.iuv[+] Creating symbol links[+] Updating the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Tracing\RASPLAP configuration.[+] Sleeping for 5 seconds so the changes take effect[+] Writing phonebook file to C:\Users\htb-student\AppData\Local\Temp\86346fa0-1b57-4cdf-a3a7-e5566ca913c7.pbk[+] Cleaning up[+] Done!
Verifying permissions on the malicious binary
As stated, once we run the exploit above, the service’s binPath will be our binary’s path
So, we can check its permissions to see if we have FULL CONTROL over it
As we mentioned here before, we have to replace the current malicious binary, as it is corrupted after running the CVE-2020-0668 exploit, with a working copy, which we have done previously