T1127.002

ClickOnce

Adversaries may use ClickOnce applications (.appref-ms and .application files) to proxy execution of malicious code through DFSVC.EXE, a trusted Windows utility responsible for installing, launching, and updating ClickOnce .NET applications. Because ClickOnce applications operate under limited permissions, they do not require administrative privileges to install, making them attractive for unprivileged execution. Abuse vectors include: luring users to install trojanized ClickOnce apps from malicious websites, invoking ClickOnce directly via rundll32.exe with dfshim.dll,ShOpenVerbApplication1, and placing .appref-ms files in startup folders for persistence.

Microsoft Sentinel / Defender
kusto
// Branch 1: DFSVC.EXE spawning suspicious child processes
let SuspiciousChildren = dynamic([
  "cmd.exe", "powershell.exe", "pwsh.exe", "mshta.exe", "wscript.exe",
  "cscript.exe", "regsvr32.exe", "rundll32.exe", "certutil.exe",
  "bitsadmin.exe", "msbuild.exe", "csc.exe", "installutil.exe"
]);
let ClickOnceExec = DeviceProcessEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName =~ "dfsvc.exe"
| where FileName in~ (SuspiciousChildren)
| extend DetectionBranch = "DfsvcSuspiciousChild"
| extend RiskScore = 80;
// Branch 2: rundll32.exe invoking dfshim.dll ClickOnce loader
let DfshimAbuse = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "rundll32.exe"
| where ProcessCommandLine has_any ("dfshim", "ShOpenVerbApplication")
| extend DetectionBranch = "RundllDfshimAbuse"
| extend RiskScore = 90;
// Branch 3: DFSVC.EXE making outbound network connections
let DfsvcNetwork = DeviceNetworkEvents
| where Timestamp > ago(24h)
| where InitiatingProcessFileName =~ "dfsvc.exe"
| where RemoteIPType == "Public"
| extend DetectionBranch = "DfsvcOutboundNetwork"
| extend RiskScore = 60
| project Timestamp, DeviceName, AccountName,
  FileName = InitiatingProcessFileName,
  ProcessCommandLine = InitiatingProcessCommandLine,
  InitiatingProcessFileName = "",
  InitiatingProcessCommandLine = "",
  DetectionBranch, RiskScore,
  RemoteUrl, RemoteIP, RemotePort;
// Branch 4: .appref-ms files written to startup or temp locations
let ApprefInStartup = DeviceFileEvents
| where Timestamp > ago(24h)
| where FileName endswith ".appref-ms" or FileName endswith ".application"
| where FolderPath has_any (
    "\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\Startup",
    "\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\Startup",
    "\\Temp\\", "\\tmp\\", "\\Downloads\\"
  )
| extend DetectionBranch = "ApprefSuspiciousLocation"
| extend RiskScore = 70
| project Timestamp, DeviceName, AccountName = RequestAccountName,
  FileName, ProcessCommandLine = InitiatingProcessCommandLine,
  InitiatingProcessFileName, InitiatingProcessCommandLine,
  DetectionBranch, RiskScore,
  RemoteUrl = "", RemoteIP = "", RemotePort = int(null);
union kind=outer
  (ClickOnceExec | project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionBranch, RiskScore, RemoteUrl="", RemoteIP="", RemotePort=int(null)),
  DfshimAbuse | project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine, InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionBranch, RiskScore, RemoteUrl="", RemoteIP="", RemotePort=int(null),
  DfsvcNetwork,
  ApprefInStartup
| sort by Timestamp desc
high severity high confidence

Data Sources

Process: Process Creation Network Traffic: Network Connection Creation File: File Creation Microsoft Defender for Endpoint

Required Tables

DeviceProcessEvents DeviceNetworkEvents DeviceFileEvents

False Positives

  • Legitimate enterprise ClickOnce applications (internal LOB apps deployed via SharePoint or intranet) where DFSVC.EXE spawns an expected child process
  • Software update mechanisms that use ClickOnce for self-updating .NET desktop applications (e.g., Visual Studio extensions, internal tooling)
  • Development environments where developers test ClickOnce packages locally, causing DFSVC.EXE network activity to localhost or internal servers
  • IT deployment tools that distribute .appref-ms shortcuts to user desktops or startup folders as part of legitimate software rollout

Unlock Pro Content

Get the full detection package for T1127.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections