Detect SyncAppvPublishingServer in Microsoft Sentinel
Adversaries may abuse SyncAppvPublishingServer.vbs to proxy execution of malicious PowerShell commands, bypassing execution restrictions and evading defensive countermeasures. SyncAppvPublishingServer.vbs is a legitimate, Microsoft-signed Visual Basic script associated with Windows Application Virtualization (App-V), located in System32 and commonly executed via wscript.exe. By embedding PowerShell commands in the script's argument using the syntax `SyncAppvPublishingServer.vbs "n; {PowerShell}"`, adversaries can invoke PowerShell logic through a trusted signed host process rather than calling powershell.exe directly. This technique has been observed in DarkHotel APT and BlueNoroff campaigns as a means of evading script-block logging, execution policy restrictions, and process-based detection rules that focus on powershell.exe as the initiating process.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1216 System Script Proxy Execution
- Sub-technique
- T1216.002 SyncAppvPublishingServer
- Canonical reference
- https://attack.mitre.org/techniques/T1216/002/
KQL Detection Query
// Branch 1: wscript.exe directly invoking SyncAppvPublishingServer.vbs with embedded PowerShell content
let SyncAppvPath = dynamic(["syncappvpublishingserver.vbs", "syncappvpublishingserver"]);
let PowerShellIndicators = dynamic([
"invoke-expression", "iex(", "iex ",
"invoke-webrequest", "net.webclient", "downloadstring", "downloadfile",
"-encodedcommand", "-enc ", "-e ",
"start-process", "new-object", "invoke-command",
"bypass", "hidden", "mimikatz", "shellcode",
"invoke-mimikatz", "amsiutils", "reflection",
"frombase64string", "io.memorystream"
]);
let SyncAppvEvents = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "wscript.exe" or FileName =~ "cscript.exe"
| where ProcessCommandLine has_any (SyncAppvPath)
| where ProcessCommandLine has_any (PowerShellIndicators)
| extend ExecutionVector = "Direct-SyncAppv-PowerShell-Proxy"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
InitiatingProcessAccountName, ProcessId, InitiatingProcessId,
ExecutionVector;
// Branch 2: PowerShell spawned by wscript.exe/cscript.exe where parent command line references SyncAppvPublishingServer
let PSFromSyncAppv = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("powershell.exe", "pwsh.exe")
| where InitiatingProcessFileName in~ ("wscript.exe", "cscript.exe")
| where InitiatingProcessCommandLine has_any (SyncAppvPath)
| extend ExecutionVector = "PowerShell-Child-Of-SyncAppv"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
InitiatingProcessAccountName, ProcessId, InitiatingProcessId,
ExecutionVector;
// Branch 3: Any process spawning SyncAppvPublishingServer.vbs from unexpected parent (not system/winlogon)
let UnexpectedParent = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("wscript.exe", "cscript.exe")
| where ProcessCommandLine has_any (SyncAppvPath)
| where InitiatingProcessFileName !in~ ("explorer.exe", "svchost.exe", "services.exe", "winlogon.exe", "cmd.exe")
| extend ExecutionVector = "SyncAppv-Unexpected-Parent"
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
InitiatingProcessAccountName, ProcessId, InitiatingProcessId,
ExecutionVector;
union SyncAppvEvents, PSFromSyncAppv, UnexpectedParent
| sort by Timestamp desc Detects abuse of SyncAppvPublishingServer.vbs to proxy PowerShell command execution. Three detection branches: (1) wscript.exe or cscript.exe invoking SyncAppvPublishingServer.vbs with embedded PowerShell indicators in the command line argument; (2) powershell.exe spawned as a child process of wscript.exe/cscript.exe where the parent command line references SyncAppvPublishingServer.vbs — capturing the actual child PowerShell process when arguments are passed correctly; (3) wscript.exe executing SyncAppvPublishingServer.vbs from an unexpected parent process indicating a non-interactive invocation chain. Uses DeviceProcessEvents from Microsoft Defender for Endpoint.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate App-V administrators running SyncAppvPublishingServer.vbs as part of application publishing workflows — the script may be invoked with parameters that superficially resemble PowerShell patterns
- MDM solutions (Microsoft Intune, SCCM) invoking SyncAppvPublishingServer.vbs during App-V package deployment and synchronization tasks on managed endpoints
- System administrators testing App-V virtualization environments where PowerShell is legitimately used alongside the SyncAppvPublishingServer script in the same session
- Security red team exercises or authorized penetration tests validating detection coverage for LOLBin-based PowerShell execution
Other platforms for T1216.002
Testing Methodology
Validate this detection against 4 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1SyncAppvPublishingServer PowerShell Proxy — Benign Command
Expected signal: Sysmon Event ID 1: wscript.exe with CommandLine containing 'SyncAppvPublishingServer.vbs' and the argument 'n; whoami'. PowerShell ScriptBlock Log Event ID 4104 may capture the proxied command execution depending on the App-V configuration. Security Event ID 4688 (if command line auditing enabled) for wscript.exe.
- Test 2SyncAppvPublishingServer PowerShell Proxy — Encoded Command
Expected signal: Sysmon Event ID 1: wscript.exe with CommandLine containing 'SyncAppvPublishingServer.vbs', '-encodedCommand', and the Base64 payload. PowerShell ScriptBlock Log Event ID 4104 capturing the decoded command 'Write-Output Argus-Test-T1216.002'. If PowerShell spawns as a child process, a second Sysmon Event ID 1 for powershell.exe with parent=wscript.exe.
- Test 3SyncAppvPublishingServer PowerShell Proxy — Download Cradle Simulation
Expected signal: Sysmon Event ID 1: wscript.exe with CommandLine containing 'SyncAppvPublishingServer.vbs', 'Net.WebClient', 'DownloadString', and 'IEX'. Sysmon Event ID 3: network connection attempt to 127.0.0.1:8080 originating from wscript.exe or a child powershell.exe. PowerShell ScriptBlock Log Event ID 4104 capturing the download cradle code.
- Test 4SyncAppvPublishingServer via cmd.exe — Indirect Invocation
Expected signal: Sysmon Event ID 1 for cmd.exe (from whatever launched the test), then Sysmon Event ID 1 for wscript.exe with ParentImage=cmd.exe and CommandLine containing 'SyncAppvPublishingServer.vbs' and the PowerShell Get-Process command. The parent-child chain cmd.exe -> wscript.exe -> [powershell proxy] is captured.
References (9)
- https://attack.mitre.org/techniques/T1216/002/
- https://lolbas-project.github.io/lolbas/Scripts/Syncappvpublishingserver/
- https://www.trellix.com/en-ca/about/newsroom/stories/research/suspected-darkhotel-apt-activity-update/
- https://securelist.com/bluenoroff-methods-bypass-motw/108383/
- https://strontic.github.io/xcyclopedia/library/SyncAppvPublishingServer.exe-3C291419F60CDF9C2E4E19AD89944FA3.html
- https://x.com/monoxgas/status/895045566090010624
- https://www.hackingarticles.in/indirect-command-execution-defense-evasion-t1202/
- https://learn.microsoft.com/en-us/windows/application-management/app-v/appv-getting-started
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1216.002/T1216.002.md
Unlock Pro Content
Get the full detection package for T1216.002 including response playbook, investigation guide, and atomic red team tests.