What it does. Detect DLL side-loading and search-order hijacking (MITRE T1574) where adversaries plant malicious DLLs for legitimate signed applications to load, by analyzing Sysmon Event ID 7 DLL-load events, checking signatures/hashes against known-good versions, and flagging path anomalies with EDR tools like CrowdStrike, MDE, or SentinelOne. Use when investigating EDR alerts on unsigned DLLs, hunting for APT persistence via trojanized applications, or triaging incidents involving DLL hijacking. Part of mukul975/Anthropic-Cybersecurity-Skills (817 security skills) (mukul975/Anthropic-Cybersecurity-Skills).
Install
npx skills add mukul975/Anthropic-Cybersecurity-Skills --skill detecting-dll-sideloading-attacks, or copy the skill folder into ~/.claude/skills/detecting-dll-sideloading-attacks/.
- Raw file:
curl -sL https://raw.githubusercontent.com/mukul975/Anthropic-Cybersecurity-Skills/HEAD/skills/detecting-dll-sideloading-attacks/SKILL.md
SKILL.md (verbatim)
name: detecting-dll-sideloading-attacks
description: Detect DLL side-loading and search-order hijacking (MITRE T1574) where adversaries plant malicious DLLs for legitimate signed applications to load, by analyzing Sysmon Event ID 7 DLL-load events, checking signatures/hashes against known-good versions, and flagging path anomalies with EDR tools like CrowdStrike, MDE, or SentinelOne. Use when investigating EDR alerts on unsigned DLLs, hunting for APT persistence via trojanized applications, or triaging incidents involving DLL hijacking.
domain: cybersecurity
subdomain: threat-hunting
tags:
- threat-hunting
- mitre-attack
- dll-sideloading
- defense-evasion
- t1574
- edr
- proactive-detection
version: '1.0'
author: mahipal
license: Apache-2.0
d3fend_techniques:
- File Metadata Consistency Validation
- Content Format Conversion
- File Content Analysis
- Platform Hardening
- File Format Verification
nist_csf:
- DE.CM-01
- DE.AE-02
- DE.AE-07
- ID.RA-05
mitre_attack:
- T1046
- T1057
- T1082
- T1083
- T1027
Detecting DLL Sideloading Attacks
When to Use
- When investigating potential DLL hijacking in enterprise environments
- After EDR alerts on unsigned DLLs loaded by signed applications
- When hunting for APT persistence using legitimate application wrappers
- During incident response to identify trojanized applications
- When threat intel indicates DLL sideloading campaigns targeting specific software
Prerequisites
- EDR with DLL load monitoring (CrowdStrike, MDE, SentinelOne)
- Sysmon Event ID 7 (Image Loaded) with hash verification
- Application whitelisting or DLL integrity monitoring
- Software inventory of legitimate applications and expected DLL paths
- Code signing verification capabilities
Workflow
- Identify Sideloading Targets: Research known vulnerable applications that load DLLs without full path qualification (LOLBAS, DLL-sideload databases).
- Monitor DLL Load Events: Query Sysmon Event ID 7 for DLL loads where the DLL path differs from the application's expected directory.
- Check DLL Signatures: Flag unsigned or untrusted DLLs loaded by signed executables.
- Detect Path Anomalies: Identify legitimate executables running from unusual locations (Temp, AppData, Public) that may be decoy wrappers.
- Hash Verification: Compare loaded DLL hashes against known-good versions and threat intel feeds.
- Correlate with Process Behavior: Check if the host process exhibits unusual behavior (network connections, child processes) after loading the suspicious DLL.
- Document and Remediate: Report sideloading instances, quarantine malicious DLLs, and update detection rules.
Key Concepts
| Concept |
Description |
| T1574.002 |
DLL Side-Loading |
| T1574.001 |
DLL Search Order Hijacking |
| T1574.006 |
Dynamic Linker Hijacking |
| T1574.008 |
Path Interception by Search Order Hijacking |
| DLL Search Order |
Windows DLL loading priority path |
| Side-Loading |
Placing malicious DLL where legitimate app loads it |
| Phantom DLL |
DLL that legitimate apps try to load but does not exist |
| DLL Proxying |
Malicious DLL forwarding calls to legitimate DLL |
| Tool |
Purpose |
| Sysmon |
Event ID 7 DLL load monitoring |
| CrowdStrike Falcon |
DLL load detection with process context |
| Microsoft Defender for Endpoint |
DLL load anomaly detection |
| Process Monitor |
Real-time DLL load tracing |
| DLL Export Viewer |
Verify DLL export functions |
| Sigcheck |
Digital signature verification |
| pe-sieve |
PE analysis for proxied DLLs |
Common Scenarios
- Legitimate App Wrapper: Adversary copies signed application (e.g., OneDrive updater) to temp folder alongside malicious DLL with same name as expected dependency.
- Phantom DLL Exploitation: Malicious DLL placed in PATH location where legitimate app searches for non-existent DLL.
- DLL Proxy Loading: Malicious version.dll proxies all exports to real version.dll while executing malicious code on DllMain.
- Software Update Hijack: Attacker replaces DLL in update staging directory before legitimate updater loads it.
Hunt ID: TH-SIDELOAD-[DATE]-[SEQ]
Technique: T1574.002
Host Application: [Legitimate signed executable]
Sideloaded DLL: [Malicious DLL name and path]
Expected DLL Path: [Where DLL should legitimately be]
DLL Signed: [Yes/No]
App Location: [Expected/Anomalous]
Host: [Hostname]
Risk Level: [Critical/High/Medium/Low]
Other files in this skill
assets/template.md (verbatim)
DLL Sideloading Hunt Template
| Field |
Value |
| Hunt ID |
TH-SIDELOAD-YYYY-MM-DD-NNN |
| Analyst |
|
| Date |
|
Hypothesis
[e.g., "Adversaries are using DLL sideloading with legitimate signed applications to execute malicious payloads while evading detection."]
Findings
| # |
Host |
Application |
Sideloaded DLL |
DLL Path |
Signed |
Risk |
Verdict |
| 1 |
|
|
|
|
|
|
|
Recommendations
- Block: [Quarantine malicious DLLs]
- Harden: [Application directory permissions, DLL safe search mode]
- Detect: [Sysmon Event ID 7 rules for known targets]
references/api-reference.md (verbatim)
API Reference: Detecting DLL Sideloading Attacks
Sysmon Event ID 7 (Image Loaded)
<EventID>7</EventID>
<Data Name="Image">C:\Users\victim\app\signed.exe</Data>
<Data Name="ImageLoaded">C:\Users\victim\app\malicious.dll</Data>
<Data Name="Signed">false</Data>
<Data Name="SignatureStatus">Unavailable</Data>
<Data Name="Hashes">SHA256=abc123...</Data>
python-evtx Usage
import Evtx.Evtx as evtx
with evtx.Evtx("Sysmon.evtx") as log:
for record in log.records():
xml = record.xml()
# Filter EventID 7, check Signed=false, non-standard path
Known Sideloading Targets
| Legitimate Executable |
Vulnerable DLL |
| vmwaretray.exe |
vmtools.dll |
| colorcpl.exe |
colorui.dll |
| consent.exe |
comctl32.dll |
| bginfo.exe |
version.dll |
| teams.exe |
version.dll |
| winword.exe |
wwlib.dll |
Splunk SPL Detection
index=sysmon EventCode=7 Signed=false
| where NOT match(ImageLoaded, "(?i)(System32|SysWOW64|Program Files)")
| stats count by Image, ImageLoaded, SignatureStatus, Computer
| where count > 0
Sigma Rule Fields
logsource:
product: windows
category: image_load
detection:
selection:
EventID: 7
Signed: "false"
filter:
ImageLoaded|startswith:
- "C:\\Windows\\System32\\"
- "C:\\Program Files\\"
CLI Usage
python agent.py --sysmon-log Sysmon.evtx
python agent.py --scan-dir C:\Users\victim\Downloads\app\
python agent.py --generate-sigma
references/standards.md (verbatim)
Standards and References - DLL Sideloading Detection
MITRE ATT&CK Mappings
T1574.002 - Hijack Execution Flow: DLL Side-Loading
- Tactic: Persistence (TA0003), Privilege Escalation (TA0004), Defense Evasion (TA0005)
- Platforms: Windows
- Data Sources: File monitoring, DLL monitoring, Process monitoring
| Technique |
Name |
| T1574.001 |
DLL Search Order Hijacking |
| T1574.006 |
Dynamic Linker Hijacking |
| T1574.008 |
Path Interception by Search Order |
| T1574.009 |
Path Interception by Unquoted Service Path |
| T1574.011 |
Services Registry Permissions Weakness |
| T1574.012 |
COR_PROFILER |
Windows DLL Search Order
- Directory of the executable (or directory specified by SetDllDirectory)
- System32 directory
- 16-bit system directory
- Windows directory
- Current working directory
- PATH environment variable directories
Known Vulnerable Applications
| Application |
Vulnerable DLL |
Vendor |
Notes |
| OneDriveUpdater.exe |
version.dll |
Microsoft |
Frequently abused by APTs |
| Teams.exe |
CRYPTSP.dll |
Microsoft |
Side-loading target |
| DismHost.exe |
dismcore.dll |
Microsoft |
Signed binary side-loading |
| MpCmdRun.exe |
mpclient.dll |
Microsoft |
AV binary abuse |
| WerFault.exe |
dbgcore.dll |
Microsoft |
Error handler abuse |
| Grammarly |
Various |
Grammarly |
User-space application |
| Zoom |
Various |
Zoom |
Meeting application |
Detection Data Sources
| Source |
Event |
Purpose |
| Sysmon Event 7 |
Image Loaded |
DLL load with hash and signature |
| Sysmon Event 1 |
Process Create |
Application launch location |
| Windows Security 4688 |
Process Create |
Command line monitoring |
| ETW |
DLL Load Events |
Kernel-level DLL tracking |
| MDE |
DeviceImageLoadEvents |
DLL load telemetry |
references/workflows.md (verbatim)
Detailed Hunting Workflow - DLL Sideloading
Phase 1: Sysmon DLL Load Analysis
Step 1.1 - Unsigned DLLs Loaded by Signed Applications
index=sysmon EventCode=7 Signed=false
| where match(Image, "(?i)\\\\(Program Files|Windows)\\\\")
| where NOT match(ImageLoaded, "(?i)\\\\(Windows|Program Files)\\\\")
| stats count by Image ImageLoaded Signature Computer
| sort -count
Step 1.2 - DLL Loads from Unusual Directories
index=sysmon EventCode=7
| where match(ImageLoaded, "(?i)(\\\\temp\\\\|\\\\appdata\\\\|\\\\public\\\\|\\\\downloads\\\\)")
| where Signed=false OR Signature="?"
| stats count by Image ImageLoaded Computer User
| sort -count
Step 1.3 - KQL for MDE DLL Sideloading
DeviceImageLoadEvents
| where Timestamp > ago(7d)
| where InitiatingProcessFileName in~ ("OneDriveUpdater.exe","DismHost.exe","WerFault.exe")
| where not(FolderPath startswith "C:\\Windows" or FolderPath startswith "C:\\Program Files")
| project Timestamp, DeviceName, InitiatingProcessFileName, FolderPath, FileName, SHA256
Phase 2: Legitimate App in Wrong Location
Step 2.1 - Signed Binaries Running Outside Standard Paths
index=sysmon EventCode=1
| where NOT match(Image, "(?i)^(C:\\\\Windows|C:\\\\Program Files)")
| where match(Image, "(?i)(svchost|explorer|rundll32|dllhost|OneDrive|Teams)\.exe$")
| table _time Computer User Image CommandLine ParentImage Hashes
Phase 3: Hash-Based Detection
Step 3.1 - Known-Bad DLL Hashes
Compare loaded DLL hashes against threat intelligence:
index=sysmon EventCode=7
| rex field=Hashes "SHA256=(?<sha256>[A-Fa-f0-9]{64})"
| lookup threat_intel_hashes sha256 OUTPUT malware_family confidence
| where isnotnull(malware_family)
| table _time Computer Image ImageLoaded sha256 malware_family
Phase 4: Behavioral Correlation
Step 4.1 - Network Activity After DLL Load
Correlate DLL loads with subsequent network connections:
index=sysmon EventCode=7 Signed=false
| rename Image as proc_image
| join proc_image Computer [
search index=sysmon EventCode=3
| rename Image as proc_image
| where NOT match(DestinationIp, "^(10\.|172\.|192\.168\.)")
]
| table _time Computer proc_image ImageLoaded DestinationIp DestinationPort
Back to mukul975/Anthropic-Cybersecurity-Skills (817 security skills) or Agent skills.