Using Squirrel Framework to escalate privileges
Last updated
Last updated
The Squirrel framework is a widely used tool for managing software installation and updates in Windows desktop applications.
Many popular applications use Squirrel for installation and updates, including (but not only):
Discord
GitHub Desktop
Atom
Postman
Exodus
Because of the way it's built, we can abuse it to try and trick the user into escalating privileges.
A key aspect of this is that most applications sign their Squirrel update binaries, which gives an extra layer of legitimacy to the attack.
In this example we will check Discord, which uses Squirrel for updating.
By checking out the Desktop shortcut that is created during installation, we can see an interesting argument passed to the Update.exe
The argument --processStart
as per the documentation "Start an executable in the latest version of the app package".
So what if we place a payload in the app directory, change the shortcut an run it?
Our payload runs!
So to create our little POC we need a few things:
Find the latest version of the app package.
Place our payload on the latest app package directory.
Change the Shortcut to lunch our payload instead of the discord binary.
The latest version of the app is inside a file located on: %localappdata%\Discord\packages\RELEASES
If we check the contents of this file, we have something like this: 230E51FC4929ACDC6DF44F0BA88B82316DDC97BF discord-updater-1.0.9013.nupkg 166474477
What we need is this value here: 1.0.9013
, to do this we can use regex and extract it:
The rootDirectory
is the root directory of discord: %localappdata%\Discord
We first need to change the argument passed to --processStart
, to now point to our payload, in addition if we want to do this without breaking the start of discord, our payload should also be able to then call discord.exe to not arouse suspicion, hence the using of --process-start-args
, the value here will be passed to our payload as an argument.
We should also set the shortcut to run as admin, since normally they will not. There is a cool trick where changing the byte with index 21 to the value 34 will set it to run as admin.
Our final code will be something like this:
If you want to see a different version of this code that tries to "weaponize" this, check:
In this project I try to search for desktop apps that use Squirrel and modify or create the desktop shortcut for them.
This can indirectly be used for a sneaky persistence. When you enable Discord to run at system startup, the same command that is in the shortcut is added to the registry.
You could just rename discord binary to other thing and name your own to Discord.exe
, the downside is that it would only work until discord updates.
Another possible usage, if no app is not present on the target machine, could be to bring those signed binaries with you and run them by creating the "app-VERSION" folder and placing your payload there.
When the user sees a UAC prompt from Discord or WhatsApp apps instead of one from an unknown and unsigned app, you might just get lucky.
The Squirrel framework is widely adopted due to its ease of handling updates for desktop applications, but its design opens up potential risks for privilege escalation.
As we’ve demonstrated with Discord, attackers can exploit signed binaries to make their actions appear legitimate, tricking users into unknowingly elevating privileges.