What three registered objects make up a WMI permanent event subscription, and why does searching the startup locations for a file find nothing?
answer
- a query, an action, a join
- registered, not dropped as a file
- kept in the repository, not a startup folder
- runs while the WMI service runs
basics
~20 sA permanent subscription is an event filter, a consumer and a binding that joins them, all registered in the WMI repository. No file sits at a startup location, and it persists across a reboot as long as WMI runs.
solid answer
~30 sA WMI permanent event subscription is three registered objects: an **event filter** (a query about an event), a **consumer** (a standard consumer class that responds to the event, one of which starts an arbitrary process on the local system) and a **binding** that associates the consumer with the filter. They are held in the WMI repository, not in a Run key or Startup folder, so a search of those places finds nothing. It fires when the filtered event occurs and persists across a reboot as long as WMI runs. The checklist must add the repository.
go deeper
Know that WMI can run a program when an event occurs and that this kind of persistence is not a normal startup file.
Name the three objects (filter, consumer, binding) and say they are held in the WMI repository.
Explain why a Run key and Startup folder review finds nothing, why all three objects must go, and what a rebuild changes.
Decide which namespaces and rights the estate leaves open for registering subscriptions, and what evidence triggers a rebuild.
## Temporary and permanent consumers WMI delivers events to consumers. A **temporary consumer** is a client that receives events only while it is loaded: it "only works when specifically loaded by a user" and ends when the script stops, WMI stops or the machine reboots. A **permanent consumer** is registered in the WMI repository, so it operates and receives events after it is created and even after a reboot of the operating system, as long as WMI is running. Only the permanent kind is a persistence trigger. ## Three registered objects A permanent subscription is made of three objects, each an instance of a WMI class: 1. **The event filter.** The registration of a permanent consumer requires an instance of the event-filter class. It holds a query describing which event to watch for. 2. **The consumer.** A standard consumer class that responds to an event with a particular action, such as sending an email message or executing a script. The command-line consumer class starts an arbitrary process in the local system when an event is delivered to it. 3. **The binding.** An association class that relates an instance of the consumer to an instance of the filter. The three together are the trigger: the filter says *when*, the consumer says *what*, the binding says *these two belong together*. Remove one and the other two stay registered and still need removing. ## Why a search of startup locations finds nothing A Run key entry is a value, and a Startup folder item is a file; both are at places a checklist already knows. A subscription is none of these. Its objects are held in the WMI repository, which is organised by namespaces, and the documentation recommends keeping permanent subscriptions in one designated namespace. There is no file at a startup location to find. The action may still *refer* to a program on disk, and then that program has a location of its own, but that location is not a start-up point. ## What it survives, and what it leaves - **Survives:** sign-out, reboot (while WMI runs), and the loss of any one user profile. - **Does not survive:** a rebuild of the host, which replaces the repository along with the operating system. - **Fires when:** the filtered event occurs, not at a fixed start-up moment. - **Leaves behind:** registered objects in the repository, and possibly a program the consumer starts. The documentation set does not state which right registration needs. Do not assume it; verify who can write to the relevant namespace in your own estate. WMI has its own security descriptors and constants for controlling access, which is where an owner restricts it. ## How it compares with the other classes - **Against a Run key:** a Run key fires at a user's sign-in; a subscription fires when its filtered event occurs. - **Against a service:** a service is a named entry in the service control manager's database; a subscription is not listed there. - **Against a scheduled task:** a task runs a program at a chosen time or on an event through the Task Scheduler; a subscription uses WMI's own event delivery. - **Against all three:** it is the only one that lives in a repository of registered objects, which is why checklists written around files and keys miss it. ## What the clean-up must cover - **Add the repository to the checklist.** A review of Run keys, Startup folders and services leaves a subscription untouched. - **Remove all three objects.** Deleting the visible consumer alone leaves a filter and a binding behind. - **Check the referenced program.** The command-line consumer page warns that the executable must be in a secure location or secured with a strong access control list; otherwise an unauthorised user can replace it. A program a subscription points at deserves the same check. - **Weigh the rebuild.** A subscription sitting beside other privileged triggers makes the extent of access doubtful, which the rebuild guidance counts as a reason to rebuild. How to hunt subscriptions across an estate, and which logged events show one being armed, are covered with the security-operations material.
- Is a temporary WMI consumer a persistence mechanism?No. A temporary consumer only works when specifically loaded by a user, so it receives events while that script or application runs, and ends when the script stops, WMI stops or the machine reboots. Only a permanent consumer, registered in the repository, keeps working across a reboot.
- What does 'as long as WMI is running' mean for the clean-up?The registered objects persist in the repository across a reboot and the subscription works whenever the WMI service is up. Stopping the service is not removal, because the objects are still registered. Removal means deleting all three objects, or rebuilding the host.
- Which documented caution applies to a consumer that starts a program?The executable must be in a secure location or secured with a strong access control list, otherwise an unauthorised user can replace it. A defender checking a subscription should therefore look at where the referenced program lives and who can write to it.
- A WMI subscription is a file in the Startup folder
- The filter alone is the whole subscription
- It stops working across a reboot
- Stopping the WMI service removes the registered objects
- Checking Run keys and services also covers WMI