Checking WMI Explorer shows the new Evil class has been created under the root\cimv2 namepace - note the EvilProperty can also be observed:
Storing Payload
For storing the payload inside the EvilProperty, let's create a base64 encoded powershell command that adds a backdoor user with credentials backdoor:backdoor:
Updating EvilProperty attribute to store $encodedCommand:
Below is the same as above, just in a screenshot:
Real Execution
Executing the payload stored in the property of a WMI class's property - note that the backdoor user has been successfully added:
If we commit the $evilClass with its .Put() method, our payload will get stored permanently in the WMI Class. Note how a new "Evil" class' properties member shows the payload we have commited:
Observations
Using the WMI Explorer, we can inspect the class' definition which is stored in%SystemRoot%\System32\wbem\Repository\OBJECTS.DATA
The file contains all the classes and other relevant information about those classes. In our case, we can see the EvilProperty with our malicious payload inside:
When inspecting the OBJECTS.DATA with a hex editor, it is possible (although not very practical nor user friendly) to find the same data - note that the screenshot is referring to the state of the Evil class at the very beginning of its creation as this is when I took the screenshot: