Detect Compromise Host Software Binary in Microsoft Sentinel
Adversaries may modify host software binaries to establish persistent access to systems. Common targets include SSH clients/servers, FTP clients, web browsers, VPN daemons, and other frequently-executed system utilities. Attackers may replace a legitimate binary entirely with a trojanized version containing credential harvesting or backdoor functionality, or patch an existing binary at its entry point to redirect execution to malicious code before resuming normal operation. After modification, adversaries may use version-lock mechanisms (e.g., yum-versionlock, apt-mark hold) to prevent legitimate updates from overwriting the trojanized binary.
MITRE ATT&CK
- Tactic
- Persistence
- Technique
- T1554 Compromise Host Software Binary
- Canonical reference
- https://attack.mitre.org/techniques/T1554/
KQL Detection Query
let SystemBinaryPaths = dynamic([
"C:\\Windows\\System32\\",
"C:\\Windows\\SysWOW64\\",
"C:\\Program Files\\OpenSSH\\",
"C:\\Program Files (x86)\\"
]);
let CriticalBinaries = dynamic([
"ssh.exe", "sshd.exe", "sftp.exe", "curl.exe", "wget.exe",
"putty.exe", "winscp.exe", "filezilla.exe",
"chrome.exe", "firefox.exe", "msedge.exe", "iexplore.exe",
"notepad.exe", "cmd.exe", "powershell.exe", "pwsh.exe",
"taskmgr.exe", "regedit.exe", "mstsc.exe", "lsass.exe"
]);
let LegitUpdaters = dynamic([
"msiexec.exe", "trustedinstaller.exe", "wusa.exe",
"setup.exe", "install.exe", "update.exe", "windowsupdate.exe"
]);
let VersionLockPatterns = dynamic([
"versionlock", "yum-versionlock", "apt-mark hold",
"dpkg --set-selections", "apt-mark unhold"
]);
// Arm 1: File writes to critical system binary locations from non-updater processes
let BinaryModifications = DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType in ("FileModified", "FileCreated", "FileRenamed")
| where FolderPath has_any (SystemBinaryPaths)
| where FileName has_any (CriticalBinaries)
| where InitiatingProcessFileName !in~ (LegitUpdaters)
| extend AlertReason = "SystemBinaryModification"
| project Timestamp, DeviceName, AccountName, FileName, FolderPath, ActionType,
InitiatingProcessFileName, InitiatingProcessCommandLine,
AlertReason, SHA256, MD5;
// Arm 2: Package manager version-lock commands (UNC3886 TTPs)
let VersionLockActivity = DeviceProcessEvents
| where Timestamp > ago(24h)
| where ProcessCommandLine has_any (VersionLockPatterns)
| extend AlertReason = "VersionLockDetected"
| project Timestamp, DeviceName, AccountName, FileName,
ProcessCommandLine, InitiatingProcessFileName,
InitiatingProcessCommandLine, AlertReason,
SHA256 = "", MD5 = "";
union BinaryModifications, VersionLockActivity
| sort by Timestamp desc Detects compromise of host software binaries through two complementary signals: (1) FileModified/FileCreated events in critical Windows system binary directories (System32, SysWOW64, Program Files\OpenSSH) attributed to non-legitimate updater processes, and (2) package manager version-lock commands (yum-versionlock, apt-mark hold) used by adversaries such as UNC3886 to prevent legitimate updates from overwriting trojanized binaries. SHA256 and MD5 hashes are captured in results for offline comparison against known-good vendor baselines.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate software updates and patching via Windows Update (TrustedInstaller) or third-party application updaters that overwrite their own executables during upgrades
- OpenSSH for Windows installation or upgrade via official installer (msiexec) replacing ssh.exe and sshd.exe in Program Files\OpenSSH
- System administrators using apt-mark hold or yum-versionlock for legitimate dependency pinning during application deployments, with corresponding change tickets
- AV/EDR product self-protection mechanisms that write modified copies of monitored binaries to staging locations as part of their own update pipeline
Other platforms for T1554
Testing Methodology
Validate this detection against 5 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 1Replace System Binary with Modified Copy (Windows)
Expected signal: Sysmon Event ID 11: FileCreate targeting C:\Windows\System32\notepad.exe with Image=powershell.exe. Sysmon Event ID 2: FileCreateTime change for notepad.exe if timestamps diverge. DeviceFileEvents ActionType=FileModified with FileName=notepad.exe in SystemBinaryPaths, InitiatingProcessFileName=powershell.exe. SHA256 will not match Microsoft-published hash.
- Test 2Hash Verification and Signature Check Workflow (Windows)
Expected signal: DeviceProcessEvents: powershell.exe executing Get-FileHash and Get-AuthenticodeSignature. No file modification events — this is read-only. Output provides hashes for comparison against Microsoft Security Response Center published values or NSRL hash database.
- Test 3Trojanize SSH Client Binary (Linux)
Expected signal: auditd: SYSCALL record for open(O_WRONLY) on /usr/bin/ssh by root/sudo, comm=cp. Linux syslog: sudo invocation logs showing binary replacement. 'rpm -V openssh-clients' reports 'S.5......' (size and hash mismatch). If MDE Linux agent deployed: DeviceFileEvents ActionType=FileModified for /usr/bin/ssh. After execution, /tmp/.t1554_harvest.log created (Sysmon Event ID 11 equivalent on Linux).
- Test 4Version Lock Compromised Package (Linux — UNC3886 TTP)
Expected signal: Linux syslog/secure: sudo execution of 'yum versionlock openssh-clients' or 'apt-mark hold openssh-client' with effective UID=0. DeviceProcessEvents (MDE Linux): ProcessCommandLine containing 'versionlock' or 'apt-mark hold', AccountName=root or sudo-invoked user. Auditd: EXECVE record for yum/apt-mark with full argument list.
- Test 5Browser Binary Replacement Simulation (macOS — XCSSET TTP)
Expected signal: macOS Unified Log: ES_EVENT_TYPE_NOTIFY_WRITE for /Applications/Firefox.app/Contents/MacOS/firefox from sudo/bash. macOS Gatekeeper: 'codesign --verify /Applications/Firefox.app' reports code signature invalid. If MDE macOS agent deployed: DeviceFileEvents ActionType=FileModified for browser binary path with initiating process=bash/sudo. macOS LaunchServices quarantine: application launch may trigger Gatekeeper alert when modified app is opened.
References (10)
- https://attack.mitre.org/techniques/T1554/
- https://cloud.google.com/blog/topics/threat-intelligence/uncovering-unc3886-espionage-operations
- https://www.welivesecurity.com/2021/01/26/kobalos-complex-linux-threat-high-performance-computing-infrastructure/
- https://www.welivesecurity.com/2014/02/21/an-in-depth-analysis-of-linuxebury/
- https://www.mandiant.com/resources/blog/cutting-edge-suspected-apt-targets-ivanti-connect-secure-vpn-zero-day-exploits
- https://web-assets.esetstatic.com/wls/2021/10/eset_fontonlake.pdf
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1554/T1554.md
- https://learn.microsoft.com/en-us/sysinternals/downloads/sigcheck
- https://man7.org/linux/man-pages/man8/auditd.8.html
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-devicefileevents-table
Unlock Pro Content
Get the full detection package for T1554 including response playbook, investigation guide, and atomic red team tests.