WRITABLE PATH
PATH INTERCEPTION
SERVICE DIRECTORY
ACL AUDIT
DetectionBlue TeamSOCOctober 12, 2026•9 min read

Detecting Writable PATH and Service Directory Privilege Escalation

If a directory early in the system PATH is writable, any privileged process that runs a bare command name can be handed the attacker’s binary instead of the real one.

Scroll

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

SignalWhereATT&CK
System PATH entry writable by Users or Authenticated UsersACL audit scriptT1574.007
System PATH value changed to add a new directorySysmon 13, 4657T1574.007
Executable or DLL created in a PATH directory by a non-adminSysmon 11, EDRT1574.007
System-tool name (whoami, ipconfig, net) running from outside System32Sysmon 1, EDRT1036.005
Service executable replaced by a non-admin accountSysmon 11, FIMT1574.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.
Vetted sources

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 EngineeringManaged Detection & ResponseThreat HuntingIncident ResponsePurple Teaming
  • 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.
Written by: Mjolnir Threat Research (MTAC)  |  Published: October 12, 2026  |  Last reviewed: October 12, 2026