Skip to content
Threat Feed
high advisory

Detection of Phantom DLL Hijacking via Malicious Library Planting

Adversaries leverage Phantom DLL hijacking by planting malicious libraries in privileged system paths to achieve local privilege escalation and persistence via legitimate Windows services.

This threat involves the exploitation of "Phantom DLL" hijacking, a technique where attackers place malicious DLLs in specific locations within C:\Windows\System32 and other system directories. These DLLs are missing from standard Windows environments, but legitimate system processes often search for them. When a process attempts to load a missing dependency, it inadvertently executes the attacker-controlled library.

This technique is a critical vector for local privilege escalation (LPE) and defense evasion. A notable implementation is the "ShieldBreak" exploit, which utilizes a privileged write operation to plant a malicious phoneinfo.dll. By subsequently triggering the Windows Error Reporting (WER) service, the attacker forces wermgr.exe to load the planted library with SYSTEM integrity. Similar activity has been associated with various campaigns, including "RoguePlanet," indicating that defenders must monitor for the creation of these specific, non-standard DLLs in sensitive system directories.

Attack Chain

  1. Attacker identifies a target Windows process or service that performs a search for a non-existent DLL in the system PATH.
  2. Attacker obtains initial access to the system, typically with sufficient privileges to write to protected directories or leveraging a secondary vulnerability (e.g., LPE or arbitrary file write).
  3. Attacker writes a malicious DLL file to a predetermined location, such as C:\Windows\System32\phoneinfo.dll, matching the target process dependency.
  4. Attacker forces or waits for a system trigger, such as a reboot, service restart, or a crash (e.g., calling Windows Error Reporting).
  5. The target process (e.g., wermgr.exe) initiates its startup or error-handling sequence and searches for the missing library.
  6. The process loads the malicious DLL from the attacker-controlled path due to search order hijacking.
  7. The malicious code within the DLL executes in the context of the target process, achieving code execution with the target's privilege level (often SYSTEM).

Impact

Successful exploitation allows for local privilege escalation, granting an attacker SYSTEM-level control over the target machine. This access facilitates persistent backdoors, credential theft, and full system compromise. The technique has been documented in multiple exploitation campaigns and research POCs targeting Windows environments, posing a significant risk to the integrity of system-level services.

Recommendation

Deploy detection rules to monitor file creation in sensitive system paths, specifically focusing on the non-existent DLLs identified as hijacking candidates. Enable Sysmon Event ID 11 (FileCreate) and ensure the logging configuration covers system directories. Audit and restrict write access to C:\Windows\System32 to authorized administrative accounts only. Investigate any alerts triggered by these DLL creation events by analyzing the creating process, file signer, and hash to differentiate between legitimate system updates and malicious activity.


Immediate actions

Deploy Sigma detection rule to SIEM and monitor for high-fidelity alerts.

Detection Engineering 48h

Mitigations

Restrict write access to C:\Windows\System32 to non-privileged users.

medium_term IT Operations

T1574.001

Detection coverage 1

Detect Creation of Phantom DLL Hijacking Candidates

high

Detects the creation of known phantom DLLs in system paths that are not typically present in standard Windows installations, indicating potential hijacking attempts.

sigma tactics: persistence techniques: T1068, T1574.001 sources: file_event, windows

Detection queries are available on the platform. Get full rules →