Detection: Print Spooler Adding A Printer Driver

Description

The following analytic detects the addition of new printer drivers by monitoring Windows PrintService operational logs, specifically EventCode 316. This detection leverages log data to identify messages indicating the addition or update of printer drivers, such as "kernelbase.dll" and "UNIDRV.DLL." This activity is significant as it may indicate exploitation attempts related to vulnerabilities like CVE-2021-34527 (PrintNightmare). If confirmed malicious, attackers could gain code execution or escalate privileges, potentially compromising the affected system. Immediate isolation and investigation of the endpoint are recommended.

1`printservice` EventCode=316 category = "Adding a printer driver" Message = "*kernelbase.dll,*" Message = "*UNIDRV.DLL,*" Message = "*.DLL.*" 
2| stats  count min(_time) as firstTime max(_time) as lastTime by OpCode EventCode ComputerName Message 
3| `security_content_ctime(firstTime)` 
4| `security_content_ctime(lastTime)` 
5| `print_spooler_adding_a_printer_driver_filter`

Data Source

Name Platform Sourcetype Source Supported App
Windows Event Log Printservice 316 Windows icon Windows 'WinEventLog' 'WinEventLog:Microsoft-Windows-PrintService/Admin' N/A

Macros Used

Name Value
printservice source="wineventlog:microsoft-windows-printservice/operational" OR source="WinEventLog:Microsoft-Windows-PrintService/Admin"
print_spooler_adding_a_printer_driver_filter search *
print_spooler_adding_a_printer_driver_filter is an empty macro by default. It allows the user to filter out any results (false positives) without editing the SPL.

Annotations

- MITRE ATT&CK
+ Kill Chain Phases
+ NIST
+ CIS
- Threat Actors
ID Technique Tactic
T1547.012 Print Processors Persistence
T1547 Boot or Logon Autostart Execution Privilege Escalation
KillChainPhase.EXPLOITAITON
KillChainPhase.INSTALLATION
NistCategory.DE_CM
Cis18Value.CIS_10
Earth Lusca

Default Configuration

This detection is configured by default in Splunk Enterprise Security to run with the following settings:

Setting Value
Disabled true
Cron Schedule 0 * * * *
Earliest Time -70m@m
Latest Time -10m@m
Schedule Window auto
Creates Notable Yes
Rule Title %name%
Rule Description %description%
Notable Event Fields user, dest
Creates Risk Event True
This configuration file applies to all detections of type TTP. These detections will use Risk Based Alerting and generate Notable Events.

Implementation

You will need to ensure PrintService Admin and Operational logs are being logged to Splunk from critical or all systems.

Known False Positives

Unknown. This may require filtering.

Associated Analytic Story

Risk Based Analytics (RBA)

Risk Message Risk Score Impact Confidence
Suspicious print driver was loaded on endpoint $ComputerName$. 72 80 90
The Risk Score is calculated by the following formula: Risk Score = (Impact * Confidence/100). Initial Confidence and Impact is set by the analytic author.

References

Detection Testing

Test Type Status Dataset Source Sourcetype
Validation Passing N/A N/A N/A
Unit Passing Dataset WinEventLog:Microsoft-Windows-PrintService/Operational WinEventLog
Integration ✅ Passing Dataset WinEventLog:Microsoft-Windows-PrintService/Operational WinEventLog

Replay any dataset to Splunk Enterprise by using our replay.py tool or the UI. Alternatively you can replay a dataset into a Splunk Attack Range


Source: GitHub | Version: 2