---
title: "CAPEC-159: Redirect Access to Libraries"
url: https://radicalnotion.ai/capec/capec-159
type: capec
description: "An adversary exploits a weakness in the way an application searches for external libraries to manipulate the execution flow to point to an adversary supplied library or code base. This pattern of attack allows the adversary to compromise the application or server via the execution of unauthorized code. An application typically makes calls to functions that are a part of libraries external to the application. These libraries may be part of the operating system or they may be third party libraries. If an adversary can redirect an application's attempts to access these libraries to other libraries that the adversary supplies, the adversary will be able to force the targeted application to execute arbitrary code. This is especially dangerous if the targeted application has enhanced privileges. Access can be redirected through a number of techniques, including the use of symbolic links, search path modification, and relative path manipulation."
updated: 2026-06-01
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CAPEC-159: Redirect Access to Libraries

- **Abstraction:** Standard
- **Status:** Stable
- **Typical severity:** Very High
- **Likelihood of attack:** High
- **CAPEC catalog version:** 3.9

## Description

An adversary exploits a weakness in the way an application searches for external libraries to manipulate the execution flow to point to an adversary supplied library or code base. This pattern of attack allows the adversary to compromise the application or server via the execution of unauthorized code. An application typically makes calls to functions that are a part of libraries external to the application. These libraries may be part of the operating system or they may be third party libraries. If an adversary can redirect an application's attempts to access these libraries to other libraries that the adversary supplies, the adversary will be able to force the targeted application to execute arbitrary code. This is especially dangerous if the targeted application has enhanced privileges. Access can be redirected through a number of techniques, including the use of symbolic links, search path modification, and relative path manipulation.

## Execution flow

### Step 1: Explore

\[Identify Target\] The adversary identifies the target application and determines what libraries are being used.

- Find public source code and identify library dependencies.
- Gain access to the system hosting the application and look for libraries in common locations.

### Step 2: Experiment

\[Deploy Malicious Libraries\] The adversary crafts malicious libraries and deploys them on the system where the application is running, or in a remote location that can be loaded by the application.

### Step 3: Exploit

\[Redirect Library Calls to Malicious Library\] Once the malicious library crafted by the adversary is deployed, the adversary will manipulate the flow of the application such that it calls the malicious library. This can be done in a variety of ways based on how the application is loading and calling libraries.

- Poison the DNS cache of the system so that it loads a malicious library from a remote location hosted by the adversary instead of the legitimate location
- Create a symlink that tricks the application into thinking that a malicious library is the legitimate library.
- Use DLL side-loading to place a malicious verison of a DLL in the windows directory.

## Prerequisites

- The target must utilize external libraries and must fail to verify the integrity of these libraries before using them.

## Skills required

- **Low:** To modify the entries in the configuration file pointing to malicious libraries
- **Medium:** To force symlink and timing issues for redirecting access to libraries
- **High:** To reverse engineering the libraries and inject malicious code into the libraries

## Consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Authorization | Execute Unauthorized Commands | Run Arbitrary Code |
| Access Control, Authorization | Bypass Protection Mechanism | - |

## Mitigations

- Implementation: Restrict the permission to modify the entries in the configuration file.
- Implementation: Check the integrity of the dynamically linked libraries before use them.
- Implementation: Use obfuscation and other techniques to prevent reverse engineering the libraries.

## Example instances

In this example, the attacker using ELF infection that redirects the Procedure Linkage Table (PLT) of an executable allowing redirection to be resident outside of the infected executable. The algorithm at the entry point code is as follows... • mark the text segment writeable • save the PLT(GOT) entry • replace the PLT(GOT) entry with the address of the new lib call The algorithm in the new library call is as follows... • do the payload of the new lib call • restore the original PLT(GOT) entry • call the lib call • save the PLT(GOT) entry again (if its changed) • replace the PLT(GOT) entry with the address of the new lib call

## Related weaknesses (CWE)

- [CWE-706](https://radicalnotion.ai/cwe/cwe-706): Use of Incorrectly-Resolved Name or Reference

## Related attack patterns

| Relationship | CAPEC | Name |
| --- | --- | --- |
| Parent | [CAPEC-154](https://radicalnotion.ai/capec/capec-154) | Resource Location Spoofing |
| Child | [CAPEC-38](https://radicalnotion.ai/capec/capec-38) | Leveraging/Manipulating Configuration File Search Paths |
| Child | [CAPEC-132](https://radicalnotion.ai/capec/capec-132) | Symlink Attack |
| Child | [CAPEC-471](https://radicalnotion.ai/capec/capec-471) | Search Order Hijacking |
| Child | [CAPEC-641](https://radicalnotion.ai/capec/capec-641) | DLL Side-Loading |
| Can precede | [CAPEC-185](https://radicalnotion.ai/capec/capec-185) | Malicious Software Download |

## Taxonomy mappings

| Taxonomy | Entry | Id |
| --- | --- | --- |
| ATTACK | Hijack Execution Flow:Path Interception by Search Order Hijacking | 1574.008 |

## Frequently asked questions

### What is CAPEC-159?

An adversary exploits a weakness in the way an application searches for external libraries to manipulate the execution flow to point to an adversary supplied library or code base. This pattern of attack allows the adversary to compromise the application or server via the execution of unauthorized code. An application typically makes calls to functions that are a part of libraries external to the application. These libraries may be part of the operating system or they may be third party libraries. If an adversary can redirect an application's attempts to access these libraries to other libraries that the adversary supplies, the adversary will be able to force the targeted application to execute arbitrary code. This is especially dangerous if the targeted application has enhanced privileges. Access can be redirected through a number of techniques, including the use of symbolic links, search path modification, and relative path manipulation.

### How does a Redirect Access to Libraries attack work?

It typically unfolds over 3 phases. It begins with: \[Identify Target\] The adversary identifies the target application and determines what libraries are being used.

### How do you prevent CAPEC-159?

Implementation: Restrict the permission to modify the entries in the configuration file.

### What weaknesses does CAPEC-159 target?

CAPEC-159 exploits one CWE weakness: CWE-706 (Use of Incorrectly-Resolved Name or Reference).

### How severe is CAPEC-159?

MITRE rates CAPEC-159 as Very High severity with high likelihood of attack.

Primary source: [MITRE CAPEC](https://capec.mitre.org/data/definitions/159.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/capec/capec-159). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
