Join our Newsletter — 33% off our NHI Course
Home› Guides› DLL Hijacking vs DLL Sideloading: How to Detect,…
Guide Attack Techniques & Malware

DLL Hijacking vs DLL Sideloading: How to Detect, Block and Respond to Each

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, edited by Lalit Choda Updated 14 November 2026 17 min read
On this page

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 PATH entry, 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

DimensionDLL hijackingDLL sideloading
Host programAlready installed by the organisation (application, service, updater)Brought in by the attacker, often a signed binary from a legitimate vendor
Where the DLL landsA directory the host searches before the real library, or where the library is missingNext to the copied host, typically in a user-writable folder such as a profile, temp or ProgramData path
Main attacker goalPersistence and privilege escalation through a program that runs at higher privilege or at startupExecution under a trusted process to avoid scrutiny; often the first stage of a loader chain
Precondition defenders controlWeak folder permissions, unquoted or relative library loads, missing DLLs, unsafe search settingsAbility of users and processes to write and run executables from user-writable locations
Typical deliveryPost-compromise, with local access already gainedArchive, installer or fake update carrying binary and DLL together
Strongest signalA new DLL written into an application or system path, then loaded by a privileged processA signed executable running from an unusual path, loading an unsigned DLL from the same folder
Primary fixFix permissions and the vulnerable load, update the applicationBlock execution from user-writable paths and enforce DLL rules
Response scopeEvery host with the same vulnerable application or permission flawEvery 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.

StepLocationDefender note
1 to 4DLL redirection, API sets, side-by-side manifest redirection, loaded-module listRedirection settings can be abused (the redirection variant); manifests with hashes help developers pin libraries
5Known DLLsLibraries 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 fromThe step sideloading relies on: a copied host finds the attacker's DLL in its own folder first
8 to 10System folder, 16-bit system folder, Windows folderProtected by default permissions; changes here are high-severity events
11The current folderMoved later in the order by safe DLL search mode; still reachable if nothing earlier matches
12Directories in PATHA 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 SafeDllSearchMode value under HKLM\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_SEARCH flags with LoadLibraryEx, or a process-wide order set with SetDefaultDllDirectories, and removing the current directory from the search path by calling SetDllDirectory with 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 objectIDRelevance
Hijack Execution Flow: DLLT1574.001Covers both hijacking and sideloading in v20
Path Interception by Search Order HijackingT1574.008The executable equivalent of DLL search order abuse; often found by the same permission audit
Process Injection: Dynamic-link Library InjectionT1055.001Not 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 SigningT1553.002Relevant when the malicious DLL itself carries a signature
Execution PreventionM1038Application control that can block DLLs loaded by legitimate software
Restrict Library LoadingM1044Safe DLL search mode and blocking remote DLL loads
AuditM1047Finding hijacking opportunities and correcting them
Update SoftwareM1051Patching applications with sideloading or hijacking flaws
Application Developer GuidanceM1013Hash 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.

SignalPoints toData sourceNotes
Signed executable running from a profile, temp, ProgramData or download path, where that binary is normally installed under Program FilesSideloadingProcess 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 folderSideloadingImage 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 minutesSideloading deliveryFile creation plus process creationCorrelate parent process and timing
New DLL created in an application folder, a PATH directory or next to a service binary, by a non-installer processHijackingFile creation, file integrity monitoringExclude software deployment tools by signer and path
A service or SYSTEM process loading a DLL from a non-system path for the first timeHijacking (privilege escalation)Image load, first-seen analyticsRarity across the fleet is a strong filter
Change to SafeDllSearchMode, KnownDLLs or DLL redirection settingsHijacking and redirectionRegistry monitoring (Sysmon registry events, EDR)Rare in normal operations
Application control audit or block for a DLLEitherAppLocker 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 .dll and .ocx files. 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 PATH entry 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, SetDefaultDllDirectories and 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

  1. Turn on scoped image load telemetry and build a baseline of signed binaries and their normal install paths.
  2. Run a permission audit of application folders, service folders and PATH entries; fix write access for non-administrators.
  3. 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.
  4. Add DLL rules in audit mode, starting with servers and fixed-function devices where the software set is stable.
  5. Move to enforcement ring by ring, keeping a signed rollback policy ready and a documented exception route.
  6. Feed audit and block events into the SIEM.

Response: what changes between the two

Response stepDLL hijackingDLL sideloading
First questionWhich 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 preserveThe planted DLL, folder ACLs, the loading process and its service or task configuration, file creation timelineThe host executable, the DLL, any encrypted data files beside them, the delivery archive or download, memory of the running process
ContainmentIsolate the host; stop the loading service or task; remove write access to the folderIsolate the host; block the hashes of the DLL and data files; block the host binary from running outside its install path
Scoping the estateFind every host with the same application and permission weaknessFind every host with the same package, the same host binary in unusual paths, or the same network indicators
EradicationRemove the DLL, fix permissions, patch or reconfigure the applicationRemove the full chain, including later-stage loaders and persistence; reset credentials used on the host
LessonsSoftware and permission hygiene, secure developmentDelivery 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.

  1. The analyst classifies it as probable sideloading: attacker-supplied host, user-writable path, unsigned library, no matching install.
  2. The host is isolated; memory and the full folder, including a data file beside the DLL, are preserved before anything is deleted.
  3. 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.
  4. Containment blocks the DLL and data file hashes and adds a rule preventing that executable from running outside Program Files.
  5. 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 PATH folders 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 PATH can expose every program that loads a missing library.

Framework mapping

FrameworkReferenceHow it applies
MITRE ATT&CK v20T1574.001, T1574.008; M1038, M1044, M1047, M1051, M1013Technique and mitigations described above
NIST SP 800-53 Rev. 5CM-7 Least FunctionalityRestricting what software and libraries may run
NIST SP 800-53 Rev. 5CM-14 Signed ComponentsVerifying signatures of components before installation or loading
NIST SP 800-53 Rev. 5SI-4 System MonitoringImage load and file creation monitoring
NIST SP 800-53 Rev. 5IR-4 Incident HandlingThe response differences set out above
NIST CSF 2.0DE.CM-09Monitoring 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 PATH folders for non-administrator write access and fix them.
  • Monitor SafeDllSearchMode, KnownDLLs and 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

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

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Researched and written by the NHI Mgmt Group editorial team using AI tools, under the editorial direction of Lalit Choda. Facts are drawn from the sources listed on this page and checked by our automated quality process. Last updated 14 November 2026. Spotted an error? Use our contact page.
NHI Mgmt Group, the independent authority on Non-Human Identity, IAM and Agentic AI security. nhimg.org

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick the PDF box to continue.