Some attacks such as PrintNightmare use spoolsv.exe to spawn processes, such as rundll32.exe. It is not normal behavior for spoolsv.exe to spawn a process, so this can be an indicator that a print spooler vulnerability has been exploited.
Run the following search. You can optimize it by specifying an index and adjusting the time range.
sourcetype=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational OR source=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational EventID=1 parent_process_name=spoolsv.exe process_name=rundll32.exe | stats count min(_time) AS firstTime max(_time) AS lastTime BY Computer, User, parent_process_name, process_name, OriginalFileName, process_path, CommandLine
The table provides an explanation of what each part of this search achieves. You can adjust this query based on the specifics of your environment.
|sourcetype=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational OR source=XmlWinEventLog:Microsoft-Windows-Sysmon/Operational||Search Sysmon operational data.|
|EventID=1||Search for a process creation event.|
|parent_process_name=spoolsv.exe process_name=rundll32.exe||Search for process rundll32.exe running from spoolsv.exe.|
|| stats count min(_time) AS firstTime max(_time) AS lastTime BY Computer, User, parent_process_name, process_name, OriginalFileName, process_path, CommandLine||Return the first and last times these processes ran, renaming the fields as shown. Then, sort first by computer and then by the rest of the fields shown.|
Be aware that there are limited instances where rundll32.exe may be spawned by a legitimate print driver.
During triage, isolate the endpoint and review for source of exploitation. Capture any additional file modification events.
If your results indicate an attack has occurred, the host or computer where the vulnerability is detected needs to be further investigated and remediated according to your response plan. This involves a final step of re-imaging the system with a known good system build after investigation.
Finally, you might be interested in other processes associated with the Detecting print spooler attacks use case.