What does persistence mean for malware on a Windows host, and which kinds of start-up trigger should a defender be able to name?
answer
- access that outlives the first run
- something relaunches the code
- a stored start-up arrangement
- per-user, machine-wide, service, WMI
basics
~20 sPersistence is a stored trigger that makes the host launch malicious code again after sign-out or reboot. A reboot ends running processes but leaves the stored trigger, so only removing the trigger stops the relaunch.
solid answer
~30 sPersistence is whatever makes the host start malicious code again once the first run has ended. On Windows the main trigger classes are a per-user autostart (a current-user Run key entry or a Startup folder item), a machine-wide autostart, a **service** held in the service control manager's database, and a **WMI permanent event subscription** held in the WMI repository; a scheduled task is a fourth. A reboot ends processes, not these stored entries, so the host relaunches the code. For a defender the question becomes which classes exist on this host and whether each one has been removed.
go deeper
Recall that persistence is a stored trigger which relaunches code, and that a reboot ends processes but not the trigger.
Name the trigger classes (autostart, service, WMI subscription, scheduled task) and say where the host keeps each.
Show why a clean-up must cover every class, since a cheap trigger often sits beside a robust one.
Treat the set of trigger classes as the scope of the clean-up standard and decide what evidence lets a host skip a rebuild.
## What persistence means A program that has run once exists as a process, and a sign-out or a reboot ends that process. **Persistence** is the stored arrangement that makes the host start the code again: a *trigger*. Access is only worth what survives the next restart, so a trigger is what an incident handler must find, and the question "is it still there?" becomes "what will this host relaunch, and where does it keep that instruction?" ## The trigger classes on Windows - **Per-user autostart.** A value under the current user's Run key, or an item in that user's Startup folder. The Run key makes a program run every time the user logs on; the Startup folder is described as the programs the system starts whenever the associated user logs on. - **Machine-wide autostart.** The matching Run key in the machine hive, and the Startup folder that holds the programs for all users. - **Service.** An entry in the service control manager's database, which is started at system boot and starts services either upon system startup or on demand, under an account chosen for the service. - **WMI permanent event subscription.** Three objects registered in the WMI repository: an event filter, a consumer and a binding that joins them. - **Scheduled task.** The Task Scheduler runs a program at a chosen time or when a specific event occurs, and it is started each time the operating system starts. It is a further class the clean-up checklist covers. ## What a reboot does and does not clear 1. The reboot ends every running process, including the malicious one. 2. The host starts again and reaches its start-up points: the service control manager, the sign-in, WMI. 3. Each start-up point reads what is stored for it and launches what it finds. 4. The code runs again, with no one having done anything. A reboot therefore removes a running process but not the stored entry that relaunches it. This is also why killing a process is not a clean-up step that ends anything. ## Why the triggers differ The classes are not interchangeable. Each trades the **rights** needed to place it against what it **survives** (a sign-out, a reboot, the loss of a profile, a rebuild) and what it **leaves behind to find**. A per-user autostart needs only the user's own rights and goes with the profile. A service needs administrator-level rights and starts at boot before anyone signs in. A WMI subscription owns no file at a startup location at all. The price list is the subject of its own question; here it is enough that the checklist is organised by class, not by the first thing found. ## Questions an interviewer follows up with - *What does it need?* The rights to write the trigger: the user's own for a per-user autostart, administrator-level for a service. - *What does it survive?* A sign-out, a reboot, the loss of a profile, or a rebuild, depending on the class. - *Where is it kept?* In a profile, in the machine hive, in the service control manager's database or in the WMI repository. - *Is a one-shot entry persistence?* The RunOnce key runs a program once and then the entry is deleted, by default before the command runs. The documentation says applications should use it only for transient conditions such as completing setup, so it is a one-time relaunch rather than a lasting trigger. ## What to carry into a clean-up - Removing the process, or the first entry found, is not finishing: one host can carry a cheap trigger beside a robust one. - Walk every class, and every user profile for the per-user class. - Remember what the owner of the estate can restrict beforehand: only administrators can create a service, so holding back administrator rights holds back the privileged classes. - A rebuild of the host removes everything resident on its disks; it does not reach credentials already read or access already used elsewhere. Reading these places as proof that something ran, and sweeping an estate to prove eradication, are covered with the security-operations material.
- A ticket says the autostart was removed, yet the program started again after the next sign-in. What do you suspect first?Another trigger of a different class. One host often carries a cheap trigger beside a robust one, so a clean-up that stops at the first one it finds is incomplete. Re-walk per-user and machine-wide autostarts, services, WMI subscriptions and scheduled tasks, and check whether a roaming profile restores the entry.
- Is a scheduled task also a persistence trigger?Yes. The Task Scheduler can run a program at a chosen time or when a specific event occurs, and it is started each time the operating system starts. It is a fourth class, so a checklist that covers autostarts, services and WMI still has to cover tasks.
- Killing the malicious process removes the infection
- Persistence just means a Run key entry
- Once the first trigger is deleted the host is clean
- Every persistence trigger needs administrator rights
- A reboot removes the stored entries that start the program