Detect Compromise Host Software Binary in Elastic Security
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/
Elastic Detection Query
sequence by host.id with maxspan=5m
[file where event.action in ("creation", "overwrite", "rename") and
file.path : (
"C:\\Windows\\System32\\*",
"C:\\Windows\\SysWOW64\\*",
"C:\\Program Files\\OpenSSH\\*",
"C:\\Program Files (x86)\\*",
"/usr/bin/*",
"/usr/sbin/*",
"/bin/*",
"/sbin/*"
) and
file.name : (
"ssh.exe", "sshd.exe", "sftp.exe", "curl.exe", "wget.exe",
"putty.exe", "winscp.exe", "chrome.exe", "firefox.exe",
"msedge.exe", "notepad.exe", "cmd.exe", "powershell.exe",
"pwsh.exe", "taskmgr.exe", "mstsc.exe", "lsass.exe",
"ssh", "sshd", "sftp", "curl", "wget", "sudo", "su"
) and
not process.name : (
"msiexec.exe", "TrustedInstaller.exe", "wusa.exe",
"setup.exe", "install.exe", "packagekitd", "dpkg",
"rpm", "yum", "apt", "apt-get", "zypper", "dnf"
)
] by host.id
OR
process where event.type == "start" and
process.args : (
"*versionlock*", "*yum-versionlock*", "*apt-mark*hold*",
"*dpkg*--set-selections*", "*apt-mark*unhold*"
) and
process.name : ("yum", "apt-mark", "dpkg", "dnf") Detects modification of critical system binaries from non-trusted updater processes (T1554). Covers Windows system32/SysWOW64 paths and Linux /usr/bin paths, plus version-lock commands used by UNC3886 and similar threat actors to prevent legitimate updates from restoring trojanized binaries.
Data Sources
Required Tables
False Positives & Tuning
- Legitimate software installations or updates performed by administrators using non-standard installer processes (e.g., scripts wrapping msiexec)
- Third-party patch management tools (e.g., SCCM, Ansible, Chef, Puppet) that write directly to system binary paths without using TrustedInstaller
- Development environments where developers legitimately replace system utilities (e.g., OpenSSH builds, curl upgrades from source) for testing purposes
- Linux package manager operations that appear under unusual parent processes due to automation pipelines
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.