Techniques
Sample rules
Spoolsv Writing a DLL - Sysmon
- source: splunk
- technicques:
- T1547.012
- T1547
Description
The following analytic identifies a .dll
being written by spoolsv.exe
. This was identified during our testing of CVE-2021-34527 previously(CVE-2021-1675) or PrintNightmare. Typically, this is not normal behavior for spoolsv.exe
to write a .dll
. Current POC code used will write the suspicious DLL to disk within a path of \spool\drivers\x64\
. During triage, isolate the endpoint and review for source of exploitation. Capture any additional file modification events.
Detection logic
`sysmon` EventID=11 process_name=spoolsv.exe file_path="*\\spool\\drivers\\x64\\*" file_name=*.dll
| stats count min(_time) as firstTime max(_time) as lastTime by dest, UserID, process_name, file_path, file_name, TargetFilename, process_id
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `spoolsv_writing_a_dll___sysmon_filter`
Powershell Fileless Process Injection via GetProcAddress
- source: splunk
- technicques:
- T1059
- T1055
- T1059.001
Description
The following analytic utilizes PowerShell Script Block Logging (EventCode=4104) to identify suspicious PowerShell execution. Script Block Logging captures the command sent to PowerShell, the full command to be executed. Upon enabling, logs will output to Windows event logs. Dependent upon volume, enable no critical endpoints or all.
This analytic identifies GetProcAddress
in the script block. This is not normal to be used by most PowerShell scripts and is typically unsafe/malicious. Many attack toolkits use GetProcAddress to obtain code execution.
In use, $var_gpa = $var_unsafe_native_methods.GetMethod(GetProcAddress
and later referenced/executed elsewhere.
During triage, review parallel processes using an EDR product or 4688 events. It will be important to understand the timeline of events around this activity. Review the entire logged PowerShell script block.
Detection logic
`powershell` EventCode=4104 ScriptBlockText=*getprocaddress*
| stats count min(_time) as firstTime max(_time) as lastTime by Opcode Computer UserID EventCode ScriptBlockText
| rename Computer as dest
| rename UserID as user
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `powershell_fileless_process_injection_via_getprocaddress_filter`