Wrong Path
Windows keeps its own programs in a few protected folders, System32 above all, and each core process has a known home among them. A Windows name running from anywhere else, or a service whose binary sits in Temp, Downloads or a user's profile, is not something Windows does. It usually means a file dropped under a trusted name, or a service installed from a folder many accounts can write to. Read the full path first and compare it with the program's own home, after removing device prefixes and ignoring case.
Normal and Suspicious
A clean machine sits beside a suspicious one, and the pointer marks where to look.
Normal
A clean Windows 11 install
| Name | Parent | Path |
|---|---|---|
svchost.exe | services.exe | C:\ |
Wmi | svchost.exe | C:\ |
Suspicious
ws-042,
| Name | Parent | Path |
|---|---|---|
services.exe | wininit.exe | C:\ |
updsvc64.exe | services.exe | C:\ |
| PathIn C:\Windows\Temp: a service binary normally runs from System32 or Program Files, not a temporary folder. Wrong Path | ||
Why It Matters
Windows keeps its own programs in a few protected folders, so a system name anywhere else is an impostor. A service or SYSTEM process running from Temp, Downloads or AppData was put there by whoever could write to it.
How to Confirm It
Work through these in order. Each step names the page that shows how.
- Read the full path and compare it with the program's home, ignoring case and removing prefixes such as \\?\ and \Device\HarddiskVolume3, because one file can be written several ways.Process Listings and Scans
- Check the folder itself. Windows or Program Files with an extra space, or a folder of that name inside another path, only looks trusted. Never trim spaces when you normalise a path.Process Listings and Scans
- Look for a file named like a Windows tool in another program's folder, because a program that starts a tool without its full path can run that copy first.Process Listings and Scans
- For a service, compare the binary with its ImagePath and its account, and with event 7045 in the System log, which records its install. A service binary in Temp is a finding on its own.Process Listings and Scans
- Find when the file landed and what wrote it (DeviceFileEvents, Sysmon events 11 and 29), then follow the writer's own chain.Process Trees and Call Chains
What Defenders See
Each record names its log and what must be switched on to get it.
| Record and Where It Lands | What to Read | How to Turn It On |
|---|---|---|
4688 A new process has been created (opens in a new tab)SecurityIt is written on the computer the process ran on. | New Process Name holds the full path. Compare it, case-insensitively, with the program's home.Process Trees and Call Chains shows how to read it. | Turn on Audit Process Creation. For the command line, also turn on Include command line in process creation events. |
1 Process creation (opens in a new tab)Microsoft-Windows-Sysmon/OperationalIt is written on any Windows computer running Sysmon. | Image, with Hashes and OriginalFileName to tell a moved Windows file from an impostor.Process Trees and Call Chains shows how to read it. | Run Sysmon with ProcessCreate events in its configuration. |
| Device | FolderPath with the file name, and Initiating | The Defender for Endpoint sensor on the device |
| DeviceFileEvents (opens in a new tab)Each row is a file creation, modification or other file system event, so it shows when a binary landed and which process wrote it.Defender XDR, advanced hunting | When the binary was written and by which process, where the trail starts for anything in Temp or AppData. | The Defender for Endpoint sensor on the device |
29 FileMicrosoft-Windows-Sysmon/OperationalIt is written on any Windows computer running Sysmon. | A new executable written to disk, with its path and hashes, where Sysmon is set to log it. | Run Sysmon with File |
AsrDeviceEventsDefender XDR, advanced hunting | The ASR rule against copied or impersonated system tools fired, so a system name ran from the wrong place. | The Defender for Endpoint sensor on the device |
What It Looks Like
This record is decoded field by field, with what each value means.
| Field, as the Record Writes It | What It Tells You |
|---|---|
New Process NameC:\ | A program running from the machine's temporary folder. Anything can be written there, so nothing there should run as a service. |
Creator Process NameC:\ | The Service Control Manager started it, so it is a service. A service binary in Temp is a red flag on its own. |
Mandatory LabelS-1-16-16384 | System integrity, so it runs with full control of the machine. Whatever the file does, it does as SYSTEM. |
- False Positives
Some genuine programs live outside System32, such as explorer.exe in C:\Windows, WmiPrvSE.exe in System32\wbem and 32-bit copies in SysWOW64. Compare each with its own home.
A program running as SYSTEM has C:\Windows\Temp as its temporary folder, so installers and updaters can run briefly from there. A known vendor, a valid signature and a short life are the signs of a genuine one.
- Blind Spots
A binary that replaced the genuine file in its home folder, or code running inside a genuine process, passes every path check, so pair this with signatures and the injection checks.
Kernel listings print device paths and some tools add \\?\, so a check that compares text without normalising it misses some mismatches and invents others.
Hunt It
The same hunt is written for four tools, so pick the one you use. Defender XDR and Sentinel queries are in KQL, which you paste into Advanced hunting in the Defender portal or into Sentinel's Logs page. Splunk queries are in SPL, for its Search page, and Velociraptor queries are in VQL, which you run as a hunt.
Needs Defender for Endpoint. FolderPath holds the full path, compared here in lower case. Defender's own platform folder under ProgramData is left out, but other agents and installers also run from ProgramData or Temp as SYSTEM, so read the rare paths first.
// System names away from their home folder, services or SYSTEM processes from writable folders, and look-alike foldersDeviceProcessEvents| where Timestamp > ago( 30d)| extend Name = tolower( FileName), Path = tolower( FolderPath)| extend System32 = strcat( @"c:\ windows\ system32\ ", Name), SysWow64 = strcat( @"c:\ windows\ syswow64\ ", Name)| where ( Name in ( "smss.exe", "csrss.exe", "wininit.exe", "winlogon.exe", "services.exe", "lsass.exe", "lsaiso.exe", "spoolsv.exe", "taskhostw.exe", "runtimebroker.exe", "conhost.exe") and Path != System32) or ( Name in ( "svchost.exe", "dllhost.exe") and Path != System32 and Path != SysWow64) or ( Name == "explorer.exe" and Path !in ( @"c:\ windows\ explorer.exe", @"c:\ windows\ syswow64\ explorer.exe")) or ( Name == "wmiprvse.exe" and Path !in ( @"c:\ windows\ system32\ wbem\ wmiprvse.exe", @"c:\ windows\ syswow64\ wbem\ wmiprvse.exe")) or ( Path matches regex @"^c:\ \ ( windows\ \ temp|programdata|users\ \ public|users\ \ [^\ \ ]+\ \ ( downloads|appdata)|\ $recycle\ .bin)\ \ " and ( InitiatingProcessFileName =~ "services.exe" or AccountSid == "S-1-5-18") and not( Path startswith @"c:\ programdata\ microsoft\ windows defender\ platform\ ")) or Path matches regex @"^c:\ \ ( windows|program files|program files \ ( x86\ )) +\ \ "| project Timestamp, DeviceName, FileName, FolderPath, InitiatingProcessFileName, AccountName, ProcessCommandLine| order by Timestamp descIn a Memory Image
Volatility 3 reads a memory image, and each of its plugins below shows part of this sign.
windows.pstree(documentation, opens in a new tab)Memory Image A Volatility 3 plugin. It is one check run on a saved copy of a Windows machine's memory. pstree means process tree. The kernel's audit path for each process, a \Device\HarddiskVolume path, beside the PEB's image path.windows.(documentation, opens in a new tab)Memory Image A Volatility 3 plugin from its malware group. It checks a memory image for code that hides, or code put into a process. The kernel's name, its audit path and the PEB's path side by side. A wrong folder shows in both paths, while paths that still disagree once normalised point to a rewritten PEB.malware. pebmasquerade windows.dlllist(documentation, opens in a new tab)Memory Image A Volatility 3 plugin. It is one check run on a saved copy of a Windows machine's memory. dlllist means DLL list. The first module each process's loader list names is its own image, with the full path.
Rules to Compare With
Security vendors publish detection rules anyone can read. These look for the same thing, so compare your own with them.
Show the 5 Public Rules
- System File Execution Location Anomaly (opens in a new tab) SigmaHQ: Flags Windows system binaries, such as lsass.exe, svchost.exe and RuntimeBroker.exe, running from outside System32, SysWOW64 or WinSxS.
- System Processes Run From Unexpected Locations (opens in a new tab) Splunk: Flags Windows system processes running from outside System32 or SysWOW64.
- Program Files Directory Masquerading (opens in a new tab) Elastic: Folders named like Program Files that are not the real one.
- Suspicious Process Masquerading As SvcHost.EXE (opens in a new tab) SigmaHQ: Flags a process named svchost.exe that is not the System32 or SysWOW64 binary.
- Potential Masquerading as Svchost (opens in a new tab) Elastic: Flags a process named svchost.exe, or one character away from it, running outside System32 and SysWOW64.
How to Prevent It
Each control helps prevent it, and its line says what it does here.
- ASR: Block use of copied or impersonated system tools (opens in a new tab) Blocks copies of System32 and SysWOW64 tools, or files with their names, when they run from anywhere else.
- App Control for Business (opens in a new tab) An unknown binary in Temp does not run, wherever it was copied, unless a policy trusts it.
- ASR: Block executable files from running unless they meet a prevalence, age, or trusted list criterion (opens in a new tab) A new, rare file such as a fresh drop in Temp fails the prevalence and age test and is blocked.
- No antivirus exclusions for temporary folders (opens in a new tab) On ws-042 a path exclusion for C:\Windows\Temp, set at 10:04, let updsvc64.exe land there unscanned two minutes later. Check it in the Registry: Microsoft Defender Exclusions
Sources
- Velociraptor: Windows.Attack.UnexpectedImagePath (opens in a new tab)
- Splunk: System Processes Run From Unexpected Locations (opens in a new tab)
- Elastic: Program Files Directory Masquerading (prebuilt rule) (opens in a new tab)
- Microsoft Learn: ASR rule, block use of copied or impersonated system tools (opens in a new tab)
- Microsoft Learn: 4688(S) A new process has been created (opens in a new tab)
- Microsoft Learn: DeviceFileEvents table (opens in a new tab)
- Microsoft Learn: Common mistakes to avoid when defining exclusions (%TEMP% for SYSTEM is C:\Windows\Temp) (opens in a new tab)
- Volatility 3: windows.pstree (opens in a new tab)
MITRE ATT&CK is a free public catalogue of the techniques attackers use. Each technique has an ID, such as T1055 for Process Injection, so defenders can name the same behaviour the same way. This red flag can point to these techniques.
- T1036.005 (opens in a new tab) Masquerading: Match Legitimate Resource Name or Location
- T1574.008 (opens in a new tab) Hijack Execution Flow: Path Interception by Search Order Hijacking