Windows Unsigned MS DLL Side-Loading
Description
The following analytic identifies potential DLL side-loading instances involving unsigned DLLs mimicking Microsoft signatures. It detects this activity by analyzing Sysmon logs for Event Code 7, where both the Image and ImageLoaded paths do not match system directories like system32, syswow64, and programfiles. This behavior is significant as adversaries often exploit DLL side-loading to execute malicious code via legitimate processes. If confirmed malicious, this activity could allow attackers to execute arbitrary code, potentially leading to privilege escalation, persistence, and unauthorized access to sensitive information.
Query · spl
`sysmon`
EventCode=7
Company="Microsoft Corporation"
Signed=false
SignatureStatus!= Valid
NOT (Image IN (
"C:\\Program Files \(x86\)\\*",
"C:\\Program Files\\*",
"C:\\Windows\\System32\\*",
"C:\\Windows\\SysWow64\\*"
)
)
NOT (ImageLoaded IN (
"C:\\Program Files \(x86\)\\*",
"C:\\Program Files\\*",
"C:\\Windows\\System32\\*",
"C:\\Windows\\SysWow64\\*"
)
)
| rex field=Image "(?<ImageFolderPath>.+\\\)"
| rex field=ImageLoaded "(?<ImageLoadedFolderPath>.+\\\)"
| where ImageFolderPath = ImageLoadedFolderPath
| stats count min(_time) as firstTime max(_time) as lastTime by Image ImageLoaded
dest loaded_file loaded_file_path original_file_name process_exec process_guid process_hash
process_id process_name process_path service_dll_signature_exists service_dll_signature_verified
signature signature_id user_id vendor_product
| `security_content_ctime(firstTime)`
| `security_content_ctime(lastTime)`
| `windows_unsigned_ms_dll_side_loading_filter`
Implementation guide
The analytic is designed to be run against Sysmon event logs collected from endpoints. The analytic requires the Sysmon event logs to be ingested into Splunk. The analytic searches for EventCode 7 where the Image is either SQLDumper.exe or SQLWriter.exe and the ImageLoaded is vcruntime140.dll. The search also filters out the legitimate loading of vcruntime140.dll from the System32 directory to reduce false positives. The analytic can be modified to include additional known good paths for vcruntime140.dll to further reduce false positives.
Known false positives
- False positives are possible if legitimate processes are loading vcruntime140.dll from non-standard directories. It is recommended to investigate the context of the process loading vcruntime140.dll to determine if it is malicious or not. Modify the search to include additional known good paths for vcruntime140.dll to reduce false positives.
Analyst notes
Known false positives: False positives are possible if legitimate processes are loading vcruntime140.dll from non-standard directories. It is recommended to investigate the context of the process loading vcruntime140.dll to determine if it is malicious or not. Modify the search to include additional known good paths for vcruntime140.dll to reduce false positives.