Lesson 147 — A New Registry Run Key Appeared
Lesson 146 uncovered a scheduled task created during the suspicious endpoint activity. Now another persistence clue appears: a new value under a Windows Registry Run key.
In this lesson we use DeviceRegistryEvents to identify the registry change, preserve the value name and data, connect the modification back to the process that made it and determine whether the same autorun pattern appears elsewhere.

Your case file
Minutes after the suspicious execution, network connection and scheduled-task activity on WS-FIN-042, Defender records a new autorun registry value.
Case briefing
Investigation objective
Use DeviceRegistryEvents to investigate changes to common Windows autorun locations, identify the process and account responsible for the change, preserve the registry value data and determine whether the same persistence pattern exists elsewhere.
Investigator's rule
A Run key is not automatically malicious. Legitimate applications use autorun locations too. The investigative value comes from the command stored in the value, who wrote it, when it appeared and how it connects to the rest of the endpoint timeline.
Stage 1 — find Run and RunOnce changes
Begin with the known device and time window. Search DeviceRegistryEvents for changes under common Run and RunOnce paths while keeping the initiating-process context visible.
let TargetDevice = "WS-FIN-042";
let TargetTime = datetime(2026-08-18 01:24:03);
DeviceRegistryEvents
| where DeviceName =~ TargetDevice
| where Timestamp between (TargetTime - 5m .. TargetTime + 10m)
| where RegistryKey has_any (
@"\Software\Microsoft\Windows\CurrentVersion\Run",
@"\Software\Microsoft\Windows\CurrentVersion\RunOnce"
)
| project Timestamp,
ActionType,
RegistryKey,
RegistryValueName,
RegistryValueData,
InitiatingProcessFileName,
InitiatingProcessCommandLine,
InitiatingProcessId,
InitiatingProcessAccountName
| order by Timestamp ascPreserve RegistryValueData
The value name may be designed to look harmless. RegistryValueData can reveal the executable, script, path or arguments Windows is being instructed to launch.
ActionType matters again
Keep ActionType so the report distinguishes creation, modification and deletion rather than describing every registry event as a newly created key or value.
Stage 2 — follow the suspicious registry value
Once a distinctive value name is identified, follow its history on the device. Preserve both current and previous value data where available so changes are not mistaken for first-time creation.
let TargetDevice = "WS-FIN-042";
let TargetValueName = "UpdateCheck";
DeviceRegistryEvents
| where DeviceName =~ TargetDevice
| where RegistryValueName =~ TargetValueName
| project Timestamp,
ActionType,
RegistryKey,
RegistryValueName,
RegistryValueData,
PreviousRegistryValueData,
InitiatingProcessFileName,
InitiatingProcessCommandLine,
InitiatingProcessId,
InitiatingProcessAccountName
| order by Timestamp ascCreation and modification differ
An existing legitimate value being changed to launch a suspicious path tells a different story from a brand-new value. The event type and previous data help establish what actually changed.
Names are weak evidence
UpdateCheck sounds ordinary. That is precisely why the investigator should focus on the stored command, process ancestry and timing rather than the friendly-looking label.
Stage 3 — identify the process that wrote the value
The initiating-process fields can connect the registry modification to the suspicious process chain already reconstructed in this case.
let TargetDevice = "WS-FIN-042";
let TargetTime = datetime(2026-08-18 01:25:11);
DeviceRegistryEvents
| where DeviceName =~ TargetDevice
| where Timestamp between (TargetTime - 5m .. TargetTime + 5m)
| where RegistryKey contains @"\CurrentVersion\Run"
| project Timestamp,
RegistryKey,
RegistryValueName,
RegistryValueData,
InitiatingProcessFileName,
InitiatingProcessCommandLine,
InitiatingProcessId,
InitiatingProcessParentFileName,
InitiatingProcessAccountName
| order by Timestamp ascConnect the writer to the case
If the registry event was initiated by PowerShell, a command shell or another process already present in the incident timeline, that relationship can substantially strengthen the persistence hypothesis.
Keep the account
The initiating account helps explain whether the persistence was created in user context, elevated context or another security principal. That can affect both scope and remediation.
Stage 4 — hunt the value across the estate
Treat the value name and, more importantly, its command data as pivots. First determine whether the same named value appears on other endpoints.
let SuspiciousValueName = "UpdateCheck";
DeviceRegistryEvents
| where Timestamp > ago(7d)
| where RegistryValueName =~ SuspiciousValueName
| summarize FirstSeen=min(Timestamp),
LastSeen=max(Timestamp),
Events=count(),
Devices=dcount(DeviceId),
DeviceNames=make_set(DeviceName, 50),
ValueData=make_set(RegistryValueData, 25),
Creators=make_set(InitiatingProcessFileName, 25)
by RegistryValueName
| order by FirstSeen ascRepeated values need comparison
A common enterprise application may legitimately create the same autorun value everywhere. Compare the value data and creating process before concluding that multiple devices are compromised.
Attackers can vary the name
If the command or path is distinctive, hunt that too. Persistence mechanisms can use different value names while still launching the same payload or script.
Stage 5 — build the registry persistence timeline
Finish by placing the relevant registry events chronologically. This shows where the autorun change sits in relation to execution, network activity and the scheduled task from the previous lesson.
let TargetDevice = "WS-FIN-042";
let StartTime = datetime(2026-08-18 01:22:00);
let EndTime = datetime(2026-08-18 01:30:00);
DeviceRegistryEvents
| where DeviceName =~ TargetDevice
| where Timestamp between (StartTime .. EndTime)
| where RegistryKey contains @"\CurrentVersion\Run"
| project Timestamp,
ActionType,
RegistryKey,
RegistryValueName,
RegistryValueData,
InitiatingProcessFileName,
InitiatingProcessCommandLine,
InitiatingProcessAccountName
| order by Timestamp ascMultiple persistence mechanisms matter
If the same suspicious chain creates both a scheduled task and a Run key, the attacker may have established more than one way to regain execution. Remediation must account for each confirmed mechanism.
Stay evidence-led
Document exactly what Defender observed first. Then explain why the registry change is suspicious in the context of the already established process, file and network evidence.
Agent Foskett's persistence timeline
Your evidence board
| Evidence | What it supports | Weight |
|---|---|---|
| Run/RunOnce value appears during incident window | Places autorun activity inside the compromise timeline. | Strong context |
| Value data references suspicious path or command | Connects persistence to suspicious execution. | Very strong |
| Initiating process belongs to attack chain | Connects the registry change to earlier endpoint activity. | Strong |
| Unexpected account writes the value | Adds identity and privilege context. | Strong when validated |
| Same value appears elsewhere | May indicate wider persistence or legitimate software. | Requires validation |
| Friendly-looking value name alone | Does not establish legitimacy or maliciousness. | Insufficient alone |
Write the finding like an investigator
Example: Microsoft Defender XDR registry telemetry on WS-FIN-042 recorded an autorun value under a Windows CurrentVersion Run location shortly after the suspicious process, network and scheduled-task activity identified earlier in the investigation. The event preserved the registry value name, stored command, initiating process, account and timestamp. The value data referenced activity associated with the suspicious execution chain, while the initiating-process context connected the registry modification to the same incident sequence. The value name and command were then hunted across the environment to determine whether similar persistence existed on other endpoints. In context, the registry change supports the hypothesis that an additional persistence mechanism was established.
Lesson 147 key takeaways
DeviceRegistryEventsprovides registry activity for Defender XDR advanced hunting.- Run and RunOnce locations are useful persistence hunting pivots but are also used legitimately.
- Preserve
ActionTypeso creation and modification are not confused. RegistryValueDataoften matters more than the friendly-looking value name.- Use initiating-process fields to identify what wrote the registry value.
- Account context can help explain the privilege and scope of the change.
- Compare current and previous value data when investigating modifications.
- Hunt distinctive value names, paths and commands across other devices.
- Multiple persistence mechanisms can exist in the same compromise.
- Interpret the registry event as part of the full process, file, network and persistence timeline.
Module 12 — the attack chain continues
Lesson 146 identified scheduled-task persistence. Lesson 147 now uncovers a second autorun mechanism in the registry. Next we investigate whether the attacker moved from persistence into credential access.
Continue your KQL investigation training
Related Agent Foskett Investigations
🔎 KQL Academy — Module 12: Advanced Endpoint Investigation
Investigate Registry Run key persistence with KQL
Lesson 147 of the Agent Foskett KQL Academy uses Microsoft Defender XDR DeviceRegistryEvents to investigate Run and RunOnce autorun changes, registry value data and initiating-process evidence.
Hunt registry persistence in Microsoft Defender XDR
Learn how to connect registry changes to suspicious endpoint execution, identify the process and account responsible, hunt related persistence across devices and write a defensible investigation finding.
