CAPEC-471
Search Order Hijacking
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.
Abstraction
Detailed
Typical severity
Medium
Likelihood of attack
Medium
Understand the attack
What is this attack pattern?
Execution flow
How does the attack proceed, step by step?
Explore
Identify target general susceptibility
Techniques used
- The attacker uses a tool such as the OSX "otool" utility or manually probes whether the target application uses dynamically linked libraries.
- The attacker finds the configuration files containing the entries to the dynamically linked libraries and modifies the entries to point to the malicious libraries the attacker crafted.
Experiment
Craft malicious libraries
Techniques used
- The attacker monitors the file operations performed by the target application using a tool like dtrace or FileMon. And the attacker can delay the operations by using "sleep(2)" and "usleep()" to prepare the appropriate conditions for the attack, or make the application perform expansive tasks (large files parsing, etc.) depending on the purpose of the application.
Exploit
Redirect the access to libraries to the malicious libraries
Techniques used
- The attacker modifies the entries in the configuration files pointing to the malicious libraries they crafted.
- The attacker leverages symlink/timing issues to redirect the target to access the malicious libraries they crafted. See also: CAPEC-132 .
- The attacker leverages file search path order issues to redirect the target to access the malicious libraries they crafted. See also: CAPEC-38 .
Requirements
What does the attack require?
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.
Resources required
Not stated in the MITRE record.
Defence
How is it prevented and mitigated?
Real world