Following our deep dive into the internals of ClickOnce application deployment in Part 1 of this two-part blog series, let’s focus on the security implications of this technology. In this blog, we examine how threat actors can weaponize ClickOnce features, and we reveal what we believe to be a new abuse that security teams need to be aware of. We conclude by outlining detection strategies and demonstrating how the CrowdStrike Falcon® sensor identifies and responds to these threats in real-world scenarios.
Now, let’s stop adversaries from clicking once and staying forever.
How Threat Actors Can Take Advantage of ClickOnce apps
Before diving into how threat actors can exploit the ClickOnce technology, let’s examine why they would choose to do so.
One factor is the user-friendliness aspect of the deployment process, which requires minimal user interaction. To deploy a ClickOnce application, threat actors only need to convince their target to click once or twice to potentially get their malware executed and persist on the target system. This option significantly simplifies the delivery phase of the kill chain as it bypasses common protection mechanisms such as mailbox filtering systems. Alternatively, ClickOnce applications can be deployed from .application files, which requires equally minimal user input and provides threat actors additional options to execute their payload.
This ease of delivering the payload is tied to a second motive: Threat actors are taking advantage of the general lack of awareness around ClickOnce apps, CrowdStrike observations show. While .exe files are heavily scrutinized and controlled in most environments, .application files can sometimes fly under the radar of security tools, creating an opportunity for threat actors to slip through traditional defenses. On the other hand, users rarely realize that clicking a webpage button can trigger software installation, typically expecting to see an executable installer in their downloads folder first. This lack of knowledge of the ClickOnce technology allows threat actors to use misleading buttons and fool users who don’t realize that clicking on it can trigger an application’s deployment.
Another advantage of ClickOnce applications for adversaries lies in the fact that they don’t require elevated privileges to be deployed. While installing a .msi package requires administrator rights, any user can install a ClickOnce app. This lowers the barrier to entry for attacks, as threat actors can target standard user accounts, which comprise the majority of enterprise endpoints.
ClickOnce applications also provide threat actors with a built-in updating mechanism. When configured to be available offline, an application reference file (.appref-ms) is dropped at the installation of the application in the Start Menu (under %Users \AppData\Roaming\Microsoft\Windows\Start Menu\Programs\). This means that every time a user starts the ClickOnce application from the Start Menu, whoever controls the server can update the app. This gives threat actors a reliable method for maintaining remote access and updating their malware as needed to change command and control (C2) addresses, move laterally, or take other actions.
Finally, threat actors benefit from the legitimacy of the ClickOnce deployment process itself. The malicious payload executes within legitimate Microsoft process trees (with rundll32.exe and dfsvc.exe), increasing the stealthiness of the execution. Further, the UI displayed to the user is a legitimate one from Microsoft.
These characteristics altogether create a powerful attack vector that security teams must actively monitor and defend against. Now that we have highlighted the reasons behind the use of ClickOnce apps to spread malware, let’s summarize previous research that uncovered ways threat actors can weaponize ClickOnce mechanisms, before revealing a new abuse.
Previous Research Introducing ClickOnce Weaponization Vectors
“ClickOnce and you’re in: When .appref-ms abuse is operating as intended” by William Burke
At Black Hat USA 2019, William Joseph Burke, CISA Red Team Lead, presented new methods to weaponize .appref-ms files. As a reminder, the .appref-ms files are dropped in the Windows’s Start Menu folder at the end of a deployment to provide users a shortcut to execute ClickOnce apps that have been configured to be available offline. When opened, the .appref-ms gets the ClickOnce components to fetch available updates from the deployment server, download any potential new components, and run the application.
Stealthy Delivering of the Payload Through Updates
As the update triggered by the .appref-ms is considered to be impacting an application that has already been approved by the user, users aren't prompted to authorize the update. This creates an opportunity for threat actors that can either compromise legitimate ClickOnce application servers or convince users to install a harmless app, to later on transform the benign application into a malicious one. All they have to do is push a malicious update into the deployment server, and the next time the user opens the .appref-ms file of the app, the malicious payload will be downloaded and run without the user realizing the application has changed.
Leveraging .appref-ms for Persistence
By definition, .appref-ms files trigger the execution of a ClickOnce application upon opening. When placed strategically, adversaries can automate their opening to use them as intermediaries, rather than directly running malicious payloads. For instance, by placing a .appref-ms file in the Startup folder or creating a scheduled task to process the file regularly, they can ensure persistence, with the added bonus of having the payload executed by Windows components.
“ClickOnce (Ab)Use for Trusted Code Execution” by Nick Powers and Steven Flores
Trojanizing Legitimate Software with Malicious Dependencies
Because malicious ClickOnce applications are usually not signed, their deployment often triggers additional security checks like SmartScreen, which increases the chances for the payload to be detected. At DEF CON 30 in 2022, Nick Powers and Steven Flores of SpecterOps presented a method to reduce this friction by trojanizing the dependencies of legitimate applications. They realized that adding a malicious dependency does not impact the application’s signature, so threat actors can embed malicious payloads in the dependencies instead of creating the application from scratch, to benefit from a valid signature.
More specifically, this abuse can be executed in two ways:
- Dependency Hijacking: Intercepting an existing ClickOnce deployment and modifying one or more dependencies while preserving the host application's signature
- New Deployment Creation: Identifying signed .NET applications without existing ClickOnce deployments and creating new deployments with trojanized dependencies
Both approaches result in threat actors having a malicious ClickOnce application with a trusted signature at their disposal, increasing the chances of the deployment going unnoticed.
Uncovering a New Abuse Using COM Hijacking
Identifying a New Attack Surface
During our deep dive into the ClickOnce deployment process, we stumbled upon something interesting at the start of the server, in the function dfdll!BindToServer().