Port Monitor
Windows provides printing functionality to the user and allows the user to add port monitors for more extendibility. Port monitor is a DLL which connects the spooling service and a printer, and allows to send raw device commands to the printer. We can abuse this for persistence by adding our own arbitrary dll that acts as a "monitor" .
This will be executed as SYSTEM, and will be spawned under spoolsv.exe.
We can do this in 2 ways, via registry or via the AddMonitor function. To do this via registry:
To do this with the AddMonitor function, here is a code snippet from ired.team that does achieves this:
Test.dll is the dll that would be persisted, note that you have to copy this over to the system32 folder before you run the above code.
Resources
Last updated