How does malware or an intruder stay on this Windows computer?
Persistence means a program is set to start again after a reboot or logon. This workflow checks the main places where Windows starts programs: run keys, startup folders, services and scheduled tasks. It then uses event logs to date each finding.
This workflow was written from the tools' documentation and published references. It has not yet been checked step by step on the practice data. If a step does not match what you see, please report it.
What you will be able to answer
- Which programs are set to start at boot or logon
- Which ones are not from Microsoft or the known software list
- Which services and scheduled tasks were added, and by which account
- When each entry was created, and whether the program ran
- Whether the entry looks like normal software or needs more analysis
What you need
- A forensic image or a triage collection of the Windows computer, or the practice event logs (see the practice section)
- A Windows workstation for the analysis tools
- A list of the software that should be on the computer, if the owner can give one
- Permission to analyse the computer, and a copy of the evidence to work on
Steps
- 1
Choose live check or image check
On a live computer, take notes first and avoid changes, because tools you run leave traces and can overwrite journals. On an image, collect the files listed below and work on copies. KAPE can collect many of them in one run. Note the computer's time zone, because registry times are UTC and some logs show local time.
Windows\System32\config\SOFTWAREWindows\System32\config\SYSTEMUsers\<user name>\NTUSER.DATWindows\System32\TasksWindows\System32\winevt\Logs - 2
Get a first list with Autoruns
Autoruns lists many auto-start locations in one view. Turn on the option to hide signed Microsoft entries and to check signatures, then read what is left. Look at the file path, the publisher and the entry name. The command line version autorunsc writes the same data to CSV, and its documentation lists a -z option for scanning an offline Windows system. Treat the list as a lead list, not as a verdict.
autorunsc -a * -c -h -s -m > autoruns.csv
The command is from the Microsoft documentation. Run it as administrator on a live system. For an image, read the autorunsc help for the offline option.
ToolsSysinternals Suite - 3
Check run keys and startup folders
Open the hives in Registry Explorer or run RegRipper plugins. Read the Run and RunOnce keys of the machine (SOFTWARE hive) and of each user (NTUSER.DAT). Also list the two Startup folders on disk. Each value is a command line. Note the program path, the arguments and the key's last write time.
SOFTWARE\Microsoft\Windows\CurrentVersion\RunSOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceNTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\RunNTUSER.DAT\Software\Microsoft\Windows\CurrentVersion\RunOnceProgramData\Microsoft\Windows\Start Menu\Programs\StartUpUsers\<user name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup - 4
Review services
Each service is a key under Services in the SYSTEM hive. Read ImagePath (the program), Start (2 means automatic, 4 means disabled), Type and DisplayName. Check every ControlSet, not only the current one. Unusual signs are a path in a user folder or Temp folder, a name that copies a real Windows service, or a start type that does not fit the program.
SYSTEM\ControlSet001\Services - 5
Review scheduled tasks
Each task has an XML file on disk and entries in the registry. Read the Actions part of the XML for the program and arguments, and the Triggers part for when it runs. In the registry, the Tree key links a task name to an Id, and the Tasks key holds its details. Compare both places, because a task can be hidden from one of them.
Windows\System32\TasksSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\TreeSOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\TasksToolsRegistry Explorer - 6
Date the entries with event logs
Event 7045 in the System log records a new service. Event 4697 in the Security log does too, when auditing is on. Event 4698 in the Security log records a new task, but only if Other Object Access auditing is on. The TaskScheduler Operational log has events 106 (created), 140 (updated), 141 (deleted) and 200 (run), but it is off by default. Parse the logs into CSV and filter on these IDs.
EvtxECmd.exe -d "C:\case\evtx" --csv "C:\case\out" --csvf events.csv --inc 7045,4697,4698,106,140,141
Windows\System32\winevt\Logs\System.evtxWindows\System32\winevt\Logs\Security.evtxWindows\System32\winevt\Logs\Microsoft-Windows-TaskScheduler%4Operational.evtx - 7
Run a rule-based scan of the logs
Hayabusa reads event logs and applies Sigma detection rules. It writes a timeline of alerts that you can sort by level and by rule name. Use it to find service and task events that you may have missed, and to see what else happened at the same time. Check each alert yourself. A rule hit is a pointer, not proof. The name of the timeline command differs between versions, so read the help of your version.
hayabusa.exe dfir-timeline -d .\evtx -o results.csv -w
Older releases call the same command csv-timeline.
- 8
Look at less common places
Check a short list of other start points: the Winlogon values Shell and Userinit, Image File Execution Options (a Debugger value), AppInit DLLs, and WMI event consumers. Autoruns shows most of them. WMI-Activity events such as 5861 can show a new consumer. These are used rarely by normal software, so every entry here needs an explanation.
SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinlogonSOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options - 9
Decide what is normal and what is not
For each suspect entry, check that the file exists, its signature and hash, its creation time in the $MFT, and whether it ran. Run records such as Prefetch and Amcache help here, and the program execution workflow on this site covers them. An entry is more concerning when the file is new, unsigned, in a user-writable folder and was created near other odd events.
Where the evidence is stored
Run and RunOnce keysSOFTWARE hive and each user's NTUSER.DATCommands that start at boot or at a user's logon
Startup foldersProgramData and the user's AppData, under Start MenuPrograms and shortcuts that start at logon
Services keysSYSTEM hiveService program path, start type and account
Task XML filesWindows\System32\TasksTask triggers, actions and author
TaskCache keysSOFTWARE hiveTask names, ids and creation details
Event 7045 and 4697System and Security event logsA new service, its file path and account
Event 4698 and TaskScheduler eventsSecurity and TaskScheduler Operational logsA new, changed or deleted task and its action
Winlogon and IFEO keysSOFTWARE hiveLess common start points that need an explanation
Check your result
- Match each service from the SYSTEM hive to a 7045 event, or explain why none exists.
- Match each task XML file to its TaskCache registry entry.
- Check the file's creation time in the $MFT against the time of the service or task event.
- Compare your Autoruns list with the Hayabusa alerts and the manual registry findings.
Common mistakes
- Treating every non-Microsoft entry as malware. Many are normal software updaters.
- Reading only the current ControlSet and missing an older service entry.
- Forgetting that the TaskScheduler log and event 4698 are often not enabled, then concluding that no task was created.
- Running Autoruns live on the evidence computer without noting it, which changes the system and your notes.
- Trusting a rule alert without opening the raw event.
Write it up
A short, careful way to state this kind of finding in a report. Change the details to match your own results.
A [service or scheduled task] named [name] was found on [computer], set to run [program path] at [trigger]. Event [7045 or 4698] shows it was created at [time, UTC] by [account]. The file was [signed or unsigned] and [was or was not] seen running. Further analysis of the program is needed.
What this does not prove
- Many persistence entries are normal. An unusual entry is a reason to look closer, not proof of an intruder.
- Service and task auditing is off by default, so the events you want may not exist.
- Registry key times show the last change to that key, not always the first creation of the entry.
- An attacker can remove an entry after use, and logs can be cleared or overwritten.
- This workflow covers common methods only. Other methods exist, such as DLL hijacking and boot-level changes, and they need extra steps.
- A live scan shows what is configured now. An image or log set shows the past. They answer different questions.
Practise on public data
EVTX-ATTACK-SAMPLES (Persistence folder)
A public collection of Windows event log files recorded while attack techniques were tested. It has a folder named Persistence. The files are logs only. There is no disk image, so the registry and file steps need a different source. The repository uses the GPL-3.0 licence.
Your task. Download a few files from the Persistence folder. Parse them with EvtxECmd and with Hayabusa. Find any event 7045 or 4698 and write down the service or task name, the program path and the time.
No public disk image built for persistence practice was found. To practise the registry steps, set up your own Windows virtual machine, add a harmless test entry (for example a Run key that starts Notepad), then image it and look for your own entry.
Where to go next
- Which programs were run on this Windows computer? Check whether the program ran
- Who logged in to this Windows computer, and when? Check logons around the creation time
- How do I build and read a super timeline of a Windows image? Build a timeline of the whole image
- Were the file times on this NTFS disk changed on purpose? Check whether file times were changed
Sources and further reading
- Microsoft: Autoruns for Windows
- Microsoft: Event 4698, a scheduled task was created
- Microsoft: Event 4697, a service was installed
- MITRE ATT&CK T1547.001: Registry Run Keys and Startup Folder
- Hayabusa on GitHub
A study guide written in our own words. It is not a legal or laboratory procedure. Follow your own lab's approved method on real cases. Last reviewed 24 Nov 2026.