PATH interception (T1574.007) plants an executable in a writable directory that appears in the system PATH ahead of the legitimate location, or where a command is not found at all. When a privileged process or script later runs that bare command name, it executes the plant. A close relative is replacing a service executable in a directory users can write (T1574.010). Both are configuration weaknesses you can audit, and both leave a file-write and an execution event.
Signals at a Glance
| Signal | Where | ATT&CK |
|---|---|---|
| System PATH entry writable by Users or Authenticated Users | ACL audit script | T1574.007 |
| System PATH value changed to add a new directory | Sysmon 13, 4657 | T1574.007 |
| Executable or DLL created in a PATH directory by a non-admin | Sysmon 11, EDR | T1574.007 |
| System-tool name (whoami, ipconfig, net) running from outside System32 | Sysmon 1, EDR | T1036.005 |
| Service executable replaced by a non-admin account | Sysmon 11, FIM | T1574.010 |
Auditing PATH and Service Directories
Most of the value is in finding writable entries before an attacker does. The script below checks each directory in the machine PATH for write-capable rights granted to broad groups; run the same logic against the directories that hold service binaries:
$paths = [Environment]::GetEnvironmentVariable('Path','Machine') -split ';' | Where-Object { $_ -and (Test-Path $_) }
foreach ($p in $paths) {
(Get-Acl $p).Access | Where-Object {
$_.AccessControlType -eq 'Allow' -and
$_.IdentityReference -match 'Users|Everyone|Authenticated Users' -and
$_.FileSystemRights -match 'Write|Modify|FullControl|CreateFiles'
} | ForEach-Object {
[pscustomobject]@{ PathEntry = $p; Identity = $_.IdentityReference; Rights = $_.FileSystemRights }
}
}
# tune/validate: the common offenders are runtime installs such as C:\Python or Ruby placed at the drive root.
Catching Planted Binaries
Interception works by placing a file that masquerades as a common tool, so look for well-known Windows tool names running from anywhere other than the Windows directories. This also catches generic masquerading, and a hit from a service context is high confidence:
// Microsoft Defender (KQL) - system tools executing from outside Windows directories
DeviceProcessEvents
| where FileName in~ ("ipconfig.exe","whoami.exe","net.exe","net1.exe","tasklist.exe",
"systeminfo.exe","netstat.exe","hostname.exe","wmic.exe","sc.exe")
| where FolderPath !startswith @"C:\Windows\System32"
and FolderPath !startswith @"C:\Windows\SysWOW64"
and FolderPath !startswith @"C:\Windows\WinSxS"
| project Timestamp, DeviceName, AccountName, FolderPath, FileName, ProcessCommandLine,
InitiatingProcessFileName
// tune/validate: some portable tools ship their own copies; allowlist by hash.
- Alert on any change to the Machine PATH value. It changes rarely, and installers are the only routine cause.
- On Linux the same weakness is a writable directory early in a cron job’s PATH or a script that calls commands by bare name as root. Audit cron files and sudo secure_path for writable entries.
- Remove user-write permission from PATH directories and service folders as a baseline control; then monitor for ACL changes with file-system auditing.
- Prefer absolute paths in scripts and scheduled actions that run with elevated privileges.
Use the SigmaHQ masquerading and PATH-change rules, Elastic’s prebuilt rules for system binaries executing from unusual paths, PowerUp for the attacker-side checks, and Atomic Red Team T1574.007 for validation. Baseline your own environment, development tooling often adds writable directories to PATH.
Build Detections That Fire
Mjolnir Security helps blue teams turn threat intelligence into high-fidelity detections across endpoint, network, identity and cloud telemetry.
- Detection Engineering We build and tune detections mapped to ATT&CK from your own telemetry.
- Threat Hunting as a Service Hypothesis-driven hunts for the behaviours on this page.
- 24/7 Incident Response Containment when a detection fires. Call +1 833 403 5875.
Stay ahead of emerging threats. Get notified when we publish new intelligence reports and advisories.
Subscribe to Alerts