CAPECattack pattern
CAPEC-471 Search Order Hijacking
Medium
Official page ↗
- Abstraction
- Detailed
- Status
- Stable
- Typical severity
- Medium
- CAPEC version
- 3.9
Description
An adversary exploits a weakness in an application's specification of external libraries to exploit the functionality of the loader where the process loading the library searches first in the same directory in which the process binary resides and then in other directories. Exploitation of this preferential search order can allow an attacker to make the loading process load the adversary's rogue library rather than the legitimate library. This attack can be leveraged with many different libraries and with many different loading processes. No forensic trails are left in the system's registry or file system that an incorrect library had been loaded.
Execution flow
1. [Explore] [Identify target general susceptibility] An attacker uses an automated tool or manually finds whether the target application uses dynamically linked libraries and the configuration file or look up table (such as Procedure Linkage Table) which contains the entries for dynamically linked libraries.
2. [Experiment] [Craft malicious libraries] The attacker uses knowledge gained in the Explore phase to craft malicious libraries that they will redirect the target to leverage. These malicious libraries could have the same APIs as the legitimate library and additional malicious code.
3. [Exploit] [Redirect the access to libraries to the malicious libraries] The attacker redirects the target to the malicious libraries they crafted in the Experiment phase. The attacker will be able to force the targeted application to execute arbitrary code when the application attempts to access the legitimate libraries.
Prerequisites
• Attacker has a mechanism to place its malicious libraries in the needed location on the file system.
Skills required
• [Medium] Ability to create a malicious library.
Mitigations
• Design: Fix the Windows loading process to eliminate the preferential search order by looking for DLLs in the precise location where they are expected
• Design: Sign system DLLs so that unauthorized DLLs can be detected.
Related
Att&ck technique · MITRE ATT&CK (3)
Child of · CAPEC (1)
- CAPEC-159 Redirect Access to Libraries attack pattern
Weakness · CWE (1)
- CWE-427 Uncontrolled Search Path Element weakness
Referenced by CWE · attack pattern (1)
- CWE-427 Uncontrolled Search Path Element weakness