Powered by ACTIVECYBER, LLC
Powered by ACTIVECYBER, LLC
The AppX Deployment Service (AppXSVC) on Microsoft Windows suffers from an arbitrary file/directory deletion vulnerability that could be triggered by standard non-privileged users due to improper user impersonation during the removal process of any application from the Windows App Store (also known as Microsoft Store) leading to an elevation of privileges attack. Now, before we dive into the finding details, let's briefly talk about the vulnerable service and Microsoft Store applications.
From a high-level overview, the AppX service is part of the WSAPPX process and it’s used for installing, removing, and updating Microsoft Store apps in the background. Microsoft Store apps (also known as Universal Windows Platform (UWP) or Universal Application Platform (UAP) apps) have several notable features. One of the key features is the fact they run on all Windows device families such as Windows phone and Xbox as opposed to traditional desktop apps which are limited to PC only. Another interesting feature about Microsoft Store apps is that they are sandboxed, as in they run with a low-integrity level inside an AppContainer (i.e. limited in terms of what they have access to on the host system), moreover, each application comes with a set of permissions required to function properly. These permissions are called capabilities and are declared as part of the application package when it’s submitted to the Store. This way, the user can decide whether these capabilities are acceptable. Here’s an example of said capabilities for OneNote.
It’s worth mentioning that the Store applications are distributed in self-contained .AppX packages, hence the service name. Now, the service has proven to be prone to elevation of privilege bugs in the past, most notably CVE-2019-0841 and CVE-2019-1064. As such we’ve decided to interact with the Microsoft Store component to see how the AppX service behaves and ultimately found the bug by removing an application from the Store. We used the below command to remove OneNote application but in reality, it could be any application using a standard non-privileged user account.
And noticed the following activity in Process Monitor under the current user AppData folder.
Most of the above operations such as reading and directory listing were performed by the AppX service while impersonating the currently logged on user.
However, file and directory deletion operations were performed with no user impersonation resulting in an arbitrary file/directory deletion with NT AUTHORITY\SYSTEM privileges.
To confirm our assumptions, we analyzed the above operation by following the stack trace below.
As an example, we decompiled the function that calls into RemoveDirectoryW + 0x145 in KernelBase and ultimately NtSetInformationFile in NTDLL where the FILE_DISPOSITION_INFORMATION_EX structure has FILE_DISPOSITION_DELETE set among other flags before switching to kernel space.
As you can see, the calling function is pretty self-explanatory and there is no user impersonation using functions like ImpersonateLoggedOnUser before RemoveDirectoryW function call and as such the AppX service will effectively iterate through all files and directories belonging to the application in question and ultimately delete them as NT AUTHORITY\SYSTEM. Let’s create a Symbolic Link using James Forshaw’s testing tools targeting C:\Windows\Help directory.
And then uninstall OneNote application from Microsoft Store.
We can see that all directories and files under the target folder have been removed.
At this point, we combined the arbitrary file/directory deletion bug with Windows Error Reporting (WER) method found by Jonas L here to build an exploit for Windows 10. Since we’re effectively abusing Microsoft Store applications to trigger the bug, we thought it would be more appropriate to run the exploit in Windows Terminal application.
We did report this bug to Microsoft and patch was released in August’s patch Tuesday. Feel free to reach out to email@example.com if you have any questions. Also, see the link here for a complete list of ACTIVELabs advisories.
Your comment will be posted after it is approved.
Leave a Reply.
ACTIVELabs was created in 2018 to hunt and research undiscovered vulnerabilities, report them to vendors via responsible disclosure programs, publish advisories, develop and validate new patches, and to share this information for the advancement of the cybersecurity community. ACTIVELabs was established with the mission of securing our ever-growing client base, partnerships, and the technology community as a whole.
We are actively providing the community with verified findings and research that leads to the creation of new Common Vulnerabilities and Exposures (CVEs) and updates to the National Vulnerability Database (NVD). For a full listing of all of our Advisories, visit our GitHub page here.
888 Bestgate Road, Suite 316
Annapolis, MD 21401 202.499.3774