
Proof of Concept Code for CVE-2023-32353: Local privilege escalation via iTunes in Windows
The MSI installer of the music player Apple iTunes contained a vulnerability that allowed a regular, low-privileged user on a Microsoft Windows Computer to gain elevated permissions in the context of NT AUTHORITY/SYSTEM. This repo contains a proof of concept (PoC) to show how this could be exploited, as well as more information for security researchers and developers that want to learn more about this type of vulnerability. However, the applicability of this is limited as you can read in the Q&A section.
I did not get a SYSTEM shell. What did I do wrong?
Since this is a proof of concept, not many thoughts were made about being undetecable. To use this, you should run an Installation of Windows 10 HOME Edition before release 'Version 10.0.19041.572', because in that version, this vulnerability got patched. I did my testing using Windows 10 1909. Also, you should navigate to "Windows Security" and disable everything related to Microsoft Defender/Windows Defender, since they seem to block the symlink creation to \RPC Control using Real Time Protection (which gets turned on automatically on every restart again, remember that!)
Should I be scared of using iTunes now?
No, just update to the latest version of iTunes and you should be fine.
Can I run the PoC without needing to build it on my own?
While I strongly encourage everyone not to run any .exe files from the internet, running the Privilege-Escalation-using-Music-Player.exe from the ./x64/Release/ directory in a virtual machine should work. If not, you should try installing the latest VC redistributable from the links provided by Microsoft.
What is the actual vulnerability here?
During the MSI repair, the installer creates low-privileged folder called "SC Info" inside of C:\ProgramData\Apple Computer\iTunes. To be precise, the directory C:\ProgramData\Apple Computer\iTunes does not allow everyone Full control. But the subfolder called "SC Info" gives Everyone (including low-privileged/standard users) Full control. If you manually delete all the contents of the C:\ProgramData\Apple Computer\iTunes\ folder (depending on whether you've ran iTunes before there might be more folders than just "SC Info"), then a low-privileged user is able to create a mount point from C:\ProgramData\Apple Computer\iTunes\ to any other directory that is writable by NT AUTHORITY/SYSTEM. In this proof of concept, the "wermgr.exe.local"-technique was used, which is already mitigated in current versions of Windows 10 and does only apply to the Windows 10 HOME edition as far as I know. So if you create a mount point from C:\ProgramData\Apple Computer\iTunes\ to \RPC Control and then a symlink from \RPC Control\SC Info (remember, SC Info is the name of the folder that the installer creates inside of the iTunes folder) to ??\c:\windows\system32\wermgr.exe.local and then use the MSI repair option of the iTunes installer, you effectively create a directory called wermgr.exe.local inside of C:\Windows\System32 which grants Full control to Everyone. This will effectively redirect the SC Info folder creation to \RPC Control, and RPC Control itself will redirect the folder creation to the System32 directory. From there on (again I tell you, this is not part of the actual vulnerability, but just to finish the privilege escalation vulnerability chain), you can create a specifically named subfolder with a crafted DLL in there which a service that will run as NT AUTHORITY/SYSTEM, even when called using a scheduled task by a low-privileged user, will load and execute the commands in there. (e.g. a cmd running as NT AUTHORITY/SYSTEM) For more details, please refer to the actual code or to the "Steps to manually reproduce" section below.
Since this is a Proof of Concept, turn off Windows Defender/Microsoft Defender (also, read Q&A section)
Install iTunes before version 12.12.9 (e.g. 12.12.4.1)
Delete all contents of C:\ProgramData\Apple Computer\iTunes, but keep the iTunes folder itself
Create a Mount Point from "C:\ProgramData\Apple Computer\iTunes" to "\RPC Control", e.g. using James Forshaw's symboliclink-testing-tools:
CreateMountPoint.exe "C:\ProgramData\Apple Computer\iTunes" "\RPC Control"
Create a Symlink from "\RPC Control\SC Info" to "??\c:\windows\system32\wermgr.exe.local"
CreateDosDeviceSymlink.exe "\RPC Control\SC Info" "??\c:\windows\system32\wermgr.exe.local"
Using the iTunes MSI/iTunes Installer EXE, "repair" your installation of iTunes (if you don't have the Installer anymore, you can locate "iTunes64.msi" in this folder: C:\ProgramData\Apple Computer\Installer Cache\iTunes )
Navigate to c:\windows\system32\wermgr.exe.local\
Create a subfolder called "amd64_microsoft.windows.common-controls_6595b64144ccf1df_6.0.18362.418_none_e6c6b287130d565d" (this can be different on your system, use the name of the latest folder starting with "amd64_microsoft.windows.common-controls_" from the C:\Windows\WinSxS\ directory)
Put a DLL file named "comctl32.dll" inside the amd64_microsoft.windows.common-controls_* folder
Run this command:
schtasks.exe /Run /TN "\Microsoft\Windows\Windows Error Reporting\QueueReporting"
The action you specified inside your comctl32.dll file will now be executed in the context of NT AUTHORITY/SYSTEM, e.g. a cmd window opens