A new technique that leverages App Paths to bypass the User Account Control (UAC) in Windows 10 has been detailed by security researcher Matt Nelson.
Over the past several months, Nelson detailed other UAC bypass methods as well, namely one abusing Event Viewer and another leveraging the Disk Cleanup utility. The former has been used in live attacks by Remcos RAT and Erebus ransomware operators, as well as by a threat actor targeting military and aerospace organizations in Russia and Belarus.
Now, the researcher uncovered yet another bypass that “doesn’t rely on the IFileOperation/DLL hijacking approach,” but which works only on Windows 10. According to Nelson, Microsoft has focused on resolving the issues leading to previously disclosed bypasses, but the new technique works on Windows 10 build 15031, “where the vast majority of public bypasses have been patched.”
Because there are Microsoft signed binaries that auto-elevate due to their manifest, the researcher decided to have a closer look, and discovered an issue associated with sdclt.exe, which is the process associated with the Backup and Restore tool in Windows. As it turns out, sdclt.exe auto-elevates due to its manifest, but only in Windows 10 (its manifest in Windows 7 prevents auto-elevation when started from medium integrity).
The execution flow of sdclt.exe reveals that the binary starts control.exe to open up a Control Panel item in high-integrity context, and the researcher discovered that the process obtains the path to control.exe by querying the App Path key for it within the HKEY_CURRENT_USER hive.
“Calls to HKEY_CURRENT_USER (or HKCU) from a high integrity process are particularly interesting. This often means that an elevated process is interacting with a registry location that a medium integrity process can tamper with,” Nelson says.
If the search for the full path of control.exe doesn’t return the key from the HKCU hive, sdclt.exe continues the typical Windows search order. However, since the key can be modified and the process searchers for it first, an attacker can use this to have sdclt.exe query a modified App Paths key. The researcher managed to have cmd.exe returned to the query, a process that is high integrity.
One thing that this technique doesn’t allow for, however, is parameters, meaning that the attacker has to place the payload to the disk. When parameters are added, the string is interpreted as the lpFile value to the ShellExecuteInfo structure, which is passed over to ShellExecuteEx, but won’t execute, given that the value doesn’t exist.
The researcher also published a script to GitHub to demonstrate the attack. “The script takes a full path to your payload. C:\Windows\System32\cmd.exe is a good one to validate. It will automatically add the keys, start sdclt.exe and then cleanup,” Nelson explains.
The attack can be prevented by setting the UAC level to “Always Notify” or by removing the current user from the Local Administrators group, the researcher explains. Further monitoring for this attack could be achieved by utilizing methods/signatures to look for and alert on new registry entries in HKCU\Microsoft\Windows\CurrentVersion\App Paths\Control.exe.