DLL hijacking and DLL sideloading both make a trusted Windows process load attacker code, but they reach that point by different routes, leave different evidence and need different fixes. In hijacking, the attacker plants a library where an existing, installed program will find it first. In sideloading, the attacker brings a legitimate, often signed, program along with the malicious library and runs the pair together. This guide compares the two from a defender's view: how each works at the level needed to detect it, how MITRE ATT&CK v20 maps them, what campaigns show, which telemetry and application control rules catch each, and how incident response differs. It is for SOC analysts, detection engineers and incident responders, and contains no commands or payloads.
Key takeaways
- The difference is who supplies the host program. Hijacking abuses a program already installed on the machine; sideloading delivers a legitimate program alongside the malicious DLL, usually in a folder the attacker can write to.
- ATT&CK v20 now tracks both under T1574.001 DLL. The old sub-technique T1574.002 DLL Side-Loading is revoked, and its content now sits inside T1574.001 with search order hijacking, redirection and phantom DLL hijacking.
- Signatures prove little on their own. Sideloading exists to borrow the reputation of a signed binary, so detection has to look at the pairing: a signed process loading an unsigned or unexpectedly signed library from an unusual path.
- Application control must cover DLLs, not just executables. AppLocker DLL rules and App Control for Business policies can stop the library from loading, but each brings a cost in rule maintenance and testing.
- Response differs in scope. Hijacking points to a writable path or a vulnerable application that must be fixed everywhere; sideloading points to a delivery chain and a dropped toolkit that must be hunted across the estate.
The short answer
Both techniques exploit the same Windows behaviour: when a program asks for a library by name rather than by full path, the loader walks a search order and loads the first match. Microsoft's documentation describes the risk plainly: if an attacker controls a directory on that search path, a malicious DLL placed there can be loaded instead of the legitimate one, and if the application runs with administrator rights this can lead to local privilege elevation.
- DLL hijacking: the attacker finds an installed program that resolves a library from a location the attacker can write to (its own folder if that folder is writable, the current directory, a
PATHentry, or a location where the expected file does not exist). The attacker plants a DLL and waits for the program, a service or a scheduled task to run. The usual goals are persistence and privilege escalation. - DLL sideloading: the attacker copies a legitimate executable that is known to load a particular DLL from its own folder, places it with a malicious DLL of that name in a writable folder, and starts the executable. The usual goal is to run a payload inside a trusted, signed process so that it is not flagged on delivery or execution.
- Phantom DLL hijacking: a variant of hijacking where the program asks for a library that does not exist on the system, so any file with the right name in a searched location wins.
- DLL redirection: a variant where the search order itself is changed through redirection settings or a redirection file, causing a program to load a DLL from a different location.
For the wider technique family, including path interception and service registry weaknesses, see the T1574 Hijack Execution Flow Defensive Guide.
Side-by-side comparison
| Dimension | DLL hijacking | DLL sideloading |
|---|---|---|
| Host program | Already installed by the organisation (application, service, updater) | Brought in by the attacker, often a signed binary from a legitimate vendor |
| Where the DLL lands | A directory the host searches before the real library, or where the library is missing | Next to the copied host, typically in a user-writable folder such as a profile, temp or ProgramData path |
| Main attacker goal | Persistence and privilege escalation through a program that runs at higher privilege or at startup | Execution under a trusted process to avoid scrutiny; often the first stage of a loader chain |
| Precondition defenders control | Weak folder permissions, unquoted or relative library loads, missing DLLs, unsafe search settings | Ability of users and processes to write and run executables from user-writable locations |
| Typical delivery | Post-compromise, with local access already gained | Archive, installer or fake update carrying binary and DLL together |
| Strongest signal | A new DLL written into an application or system path, then loaded by a privileged process | A signed executable running from an unusual path, loading an unsigned DLL from the same folder |
| Primary fix | Fix permissions and the vulnerable load, update the application | Block execution from user-writable paths and enforce DLL rules |
| Response scope | Every host with the same vulnerable application or permission flaw | Every host that received the same package, plus the loader's later stages |
How the Windows search order makes both possible
Microsoft documents the standard search order for unpackaged desktop applications with safe DLL search mode on. The steps an attacker can influence matter most.
| Step | Location | Defender note |
|---|---|---|
| 1 to 4 | DLL redirection, API sets, side-by-side manifest redirection, loaded-module list | Redirection settings can be abused (the redirection variant); manifests with hashes help developers pin libraries |
| 5 | Known DLLs | Libraries listed under HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\KnownDLLs always load from the system copy, so they cannot be hijacked this way |
| 7 (after step 6, package dependencies) | The folder the application loaded from | The step sideloading relies on: a copied host finds the attacker's DLL in its own folder first |
| 8 to 10 | System folder, 16-bit system folder, Windows folder | Protected by default permissions; changes here are high-severity events |
| 11 | The current folder | Moved later in the order by safe DLL search mode; still reachable if nothing earlier matches |
| 12 | Directories in PATH | A writable PATH entry is a classic hijacking precondition, especially for phantom DLLs |
- Safe DLL search mode: on by default since Windows XP SP2 and controlled by the
SafeDllSearchModevalue underHKLM\System\CurrentControlSet\Control\Session Manager. Setting it to 0 moves the current folder up to just after the application folder. Treat any change to this value as a detection. - Developer controls: Microsoft recommends fully qualified paths, the
LOAD_LIBRARY_SEARCHflags withLoadLibraryEx, or a process-wide order set withSetDefaultDllDirectories, and removing the current directory from the search path by callingSetDllDirectorywith an empty string early in process start-up. These close hijacking at source; they do not stop sideloading, because there the attacker's DLL sits in the application folder, which these settings still search.
ATT&CK v20 mapping
In ATT&CK v20, T1574.001 is named simply "DLL" and describes sideloading, search order hijacking, redirection and phantom DLL hijacking as ways the same library mechanism is abused. T1574.002 DLL Side-Loading is revoked, so detections and reports tagged with it should be re-tagged to T1574.001. T1574.001 sits under the Stealth and Execution tactics in v20.
| ATT&CK object | ID | Relevance |
|---|---|---|
| Hijack Execution Flow: DLL | T1574.001 | Covers both hijacking and sideloading in v20 |
| Path Interception by Search Order Hijacking | T1574.008 | The executable equivalent of DLL search order abuse; often found by the same permission audit |
| Process Injection: Dynamic-link Library Injection | T1055.001 | Not the same thing: injection forces a DLL into a running process, while hijacking and sideloading let the loader choose the wrong file |
| Subvert Trust Controls: Code Signing | T1553.002 | Relevant when the malicious DLL itself carries a signature |
| Execution Prevention | M1038 | Application control that can block DLLs loaded by legitimate software |
| Restrict Library Loading | M1044 | Safe DLL search mode and blocking remote DLL loads |
| Audit | M1047 | Finding hijacking opportunities and correcting them |
| Update Software | M1051 | Patching applications with sideloading or hijacking flaws |
| Application Developer Guidance | M1013 | Hash values in manifest files to prevent loading of malicious libraries |
ATT&CK v20 also links T1574.001 to detection strategy DET0201, Detection Strategy for Hijack Execution Flow for DLLs, which is a useful starting point for mapping your analytics coverage.
What campaigns show
ATT&CK v20 lists 36 groups that use T1574.001, among them APT41, Lazarus Group, menuPass, MuddyWater, Mustang Panda and Threat Group-3390. The attribution below comes from the reporting organisations, at group level only.
- Printer utility as a host: Google Threat Intelligence Group reported in August 2025 on UNC6384, a PRC-nexus espionage group it assesses as associated with TEMP.Hex (Mustang Panda), targeting diplomats in Southeast Asia and other organisations. After a signed first-stage downloader, the chain used a legitimate-looking executable presented as a Canon printer assistant tool to load a malicious DLL of the name it expected, which then decrypted a PlugX variant from an encrypted data file and ran it in memory. GTIG notes that because these steps run in memory, file-based detection is less likely to catch them, and advises treating valid digital signatures with caution.
- Scale of a sideloading-delivered implant: the US Department of Justice announced in January 2025 a court-authorised operation, with international partners, that deleted PlugX from approximately 4,258 US computers and networks. It attributes the malware's use to a group sponsored by the People's Republic of China, which the private sector calls Mustang Panda and Twill Typhoon.
- Loader fragmentation: ATT&CK v20 notes that adversaries chain sideloading across several DLLs, splitting loader functions or using a DLL whose only job is to load the next one, so that all files must be collected to understand the behaviour.
Detection: different signals for each
Image load telemetry is the core data source for both. Sysmon Event ID 7 (Image loaded) records the process that loaded a module, hashes and signature information, but it is disabled by default and Microsoft warns that monitoring all image loads generates a significant amount of logging. Most EDR products collect equivalent module load events. Scope it to user-writable paths and high-value processes first.
| Signal | Points to | Data source | Notes |
|---|---|---|---|
| Signed executable running from a profile, temp, ProgramData or download path, where that binary is normally installed under Program Files | Sideloading | Process creation (Sysmon Event ID 1, EDR) | Build a baseline of where each signed product normally runs |
| Signed process loading an unsigned DLL, or a DLL with a different signer, from its own folder | Sideloading | Image load with signature fields (Sysmon Event ID 7, EDR) | The highest-value single analytic for sideloading |
| Executable and DLL written together by an archive tool, browser or installer, then executed within minutes | Sideloading delivery | File creation plus process creation | Correlate parent process and timing |
New DLL created in an application folder, a PATH directory or next to a service binary, by a non-installer process | Hijacking | File creation, file integrity monitoring | Exclude software deployment tools by signer and path |
| A service or SYSTEM process loading a DLL from a non-system path for the first time | Hijacking (privilege escalation) | Image load, first-seen analytics | Rarity across the fleet is a strong filter |
Change to SafeDllSearchMode, KnownDLLs or DLL redirection settings | Hijacking and redirection | Registry monitoring (Sysmon registry events, EDR) | Rare in normal operations |
| Application control audit or block for a DLL | Either | AppLocker EXE and DLL log (8003 audit, 8004 block); CodeIntegrity Operational log (3076 audit, 3077 block) | Event 3089 carries the signature details for App Control blocks |
For query patterns, see the KQL for Threat Hunting Guide. For how endpoint telemetry choices affect what you can see, see the EDR Guide.
Prevention: application control and hardening
Hardening the search order and controlling which libraries can load are complementary. The first removes hijacking opportunities; the second stops a library from loading whichever route put it there.
- AppLocker DLL rules: the DLL rule collection covers
.dlland.ocxfiles. Microsoft's default rules allow all DLLs for administrators and DLLs under%windir%and%programfiles%for everyone. Microsoft warns that with DLL rules a DLL allow rule is needed for every DLL used by every allowed app, including Windows files, and that AppLocker must check each DLL an app loads, which can reduce performance on resource-constrained devices. Path rules limited to protected folders stop a sideloaded pair running from a profile folder. - App Control for Business: changes Windows from running code unless it is predicted to be bad to running code only if policy allows it, and covers kernel code, scripts and MSI files as well as applications. Microsoft lists events 3064 and 3065 for user-mode DLLs that would fail or do fail policy, in audit and enforced modes respectively. See the App Control for Business (WDAC) guide for policy design.
- Block execution from user-writable paths: the single control that defeats most sideloading, because the copied host has to run from somewhere the user can write.
- Folder permissions: audit application folders, service binary folders and every
PATHentry for write access by non-administrators. This is the M1047 audit step and removes most hijacking opportunities. - Update software: patch applications that load libraries unsafely (M1051).
- Developer guidance for in-house software: fully qualified paths,
SetDefaultDllDirectoriesand manifests with hashes (M1013). Add a DLL loading check to secure code review.
For the wider decision on default-deny control, see the Application Allowlisting Guide and Application Allowlisting vs EDR.
Rollout order
- Turn on scoped image load telemetry and build a baseline of signed binaries and their normal install paths.
- Run a permission audit of application folders, service folders and
PATHentries; fix write access for non-administrators. - Deploy a policy blocking execution from user-writable paths in audit mode to a pilot ring; review AppLocker 8003 or CodeIntegrity 3076 events for two to four weeks.
- Add DLL rules in audit mode, starting with servers and fixed-function devices where the software set is stable.
- Move to enforcement ring by ring, keeping a signed rollback policy ready and a documented exception route.
- Feed audit and block events into the SIEM.
Response: what changes between the two
| Response step | DLL hijacking | DLL sideloading |
|---|---|---|
| First question | Which program loaded the DLL, at what privilege, and how did the attacker get write access to that folder? | How did the executable and DLL pair arrive, and what did the loaded payload do next? |
| Evidence to preserve | The planted DLL, folder ACLs, the loading process and its service or task configuration, file creation timeline | The host executable, the DLL, any encrypted data files beside them, the delivery archive or download, memory of the running process |
| Containment | Isolate the host; stop the loading service or task; remove write access to the folder | Isolate the host; block the hashes of the DLL and data files; block the host binary from running outside its install path |
| Scoping the estate | Find every host with the same application and permission weakness | Find every host with the same package, the same host binary in unusual paths, or the same network indicators |
| Eradication | Remove the DLL, fix permissions, patch or reconfigure the application | Remove the full chain, including later-stage loaders and persistence; reset credentials used on the host |
| Lessons | Software and permission hygiene, secure development | Delivery controls, execution from user paths, signed-binary trust assumptions |
For the general response sequence, see the Digital Forensics (DFIR) Guide.
Worked scenario
An EDR alert shows a signed executable from a well-known printer vendor running from a folder under a user's AppData path and loading an unsigned DLL from the same folder. The organisation's baseline shows that product installed only under Program Files on a handful of print servers.
- The analyst classifies it as probable sideloading: attacker-supplied host, user-writable path, unsigned library, no matching install.
- The host is isolated; memory and the full folder, including a data file beside the DLL, are preserved before anything is deleted.
- Hunting finds the same host binary name in AppData on three other laptops, all of which opened the same archive from a fake software update page.
- Containment blocks the DLL and data file hashes and adds a rule preventing that executable from running outside Program Files.
- Eradication removes all stages and persistence, and credentials used on the four laptops are reset.
Had the alert shown a new DLL in a server application folder loaded by a SYSTEM service, the response would instead centre on how the attacker gained write access and which servers share that permission flaw.
Where identity fits
A hijacked service running as a service account, or a sideloaded payload inside a process with its own token, inherits whatever that identity can reach. During response, list every service account, scheduled task identity and stored secret on affected hosts and rotate them.
Decision guidance
- Limited budget, small team: start with blocking execution from user-writable paths and the permission audit. Together they address most sideloading and most hijacking without full DLL allowlisting.
- Large or regulated estate: add DLL enforcement on servers and fixed-function endpoints first, where software changes slowly, and accept audit mode on developer workstations with strong telemetry.
- Heavy in-house development: add DLL loading checks to code review; your own software can be the target.
- Espionage threat model: prioritise sideloading analytics and memory capture, because the payload may never touch disk unencrypted.
Detection and measurement
- Image load coverage: percentage of endpoints and servers sending image load events for user-writable paths.
- Writable path findings: number of application, service and
PATHfolders writable by non-administrators, trending to zero. - Execution from user paths: count of signed executables running from user-writable folders per week, and the share reviewed.
- Application control enforcement: share of devices with DLL rules or user-path execution blocks enforced rather than in audit.
- Time to scope: hours from first sideloading alert to a complete list of affected hosts.
Common failure patterns
- Allowlisting by signer alone: a rule that trusts a vendor's certificate lets an old, signed binary from that vendor become a sideloading host.
- Executable-only application control: blocking unknown executables while allowing any DLL leaves both techniques open.
- Collecting no image loads: Sysmon Event ID 7 is off by default, and teams that never scoped it in have no evidence of what a process loaded.
- Quarantining one file: removing the DLL while leaving the encrypted payload file and later loaders behind.
- Ignoring PATH: a single writable directory in the system
PATHcan expose every program that loads a missing library.
Framework mapping
| Framework | Reference | How it applies |
|---|---|---|
| MITRE ATT&CK v20 | T1574.001, T1574.008; M1038, M1044, M1047, M1051, M1013 | Technique and mitigations described above |
| NIST SP 800-53 Rev. 5 | CM-7 Least Functionality | Restricting what software and libraries may run |
| NIST SP 800-53 Rev. 5 | CM-14 Signed Components | Verifying signatures of components before installation or loading |
| NIST SP 800-53 Rev. 5 | SI-4 System Monitoring | Image load and file creation monitoring |
| NIST SP 800-53 Rev. 5 | IR-4 Incident Handling | The response differences set out above |
| NIST CSF 2.0 | DE.CM-09 | Monitoring software and runtime environments for adverse events |
Practitioner checklist
- Re-tag any detection content mapped to T1574.002 to T1574.001.
- Enable image load telemetry for user-writable paths and high-value processes, with signature fields.
- Baseline where each signed product normally runs, and alert when it runs elsewhere.
- Alert on signed processes loading unsigned or differently signed DLLs from their own folder.
- Audit application, service and
PATHfolders for non-administrator write access and fix them. - Monitor
SafeDllSearchMode,KnownDLLsand DLL redirection settings for change. - Block execution from user-writable folders, piloted in audit mode first.
- Add DLL rules on servers and fixed-function devices, with a tested rollback policy.
- Preserve the full folder and process memory before removing any DLL.
- Rotate service account credentials and secrets on affected hosts.
Standards and references
- MITRE ATT&CK: Hijack Execution Flow: DLL (T1574.001)
- Microsoft: Dynamic-link library search order
- Microsoft: Dynamic-Link Library Security
- Microsoft: DLL rules in AppLocker
- Microsoft: Understanding App Control event IDs
- Microsoft Sysinternals: Sysmon
- Google Threat Intelligence Group: PRC-nexus espionage campaign targets diplomats
- US Department of Justice: Operation to delete PlugX malware
Related NHI Mgmt Group resources: T1574 Hijack Execution Flow Defensive Guide · App Control for Business (WDAC) · Application Allowlisting Guide · EDR Guide · Code Signing Security Guide