CAPECattack pattern

CAPEC-159 Redirect Access to Libraries

Very High Official page ↗
Abstraction
Standard
Status
Stable
Likelihood of attack
High
Typical severity
Very High
CAPEC 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

1. [Explore] [Identify Target] The adversary identifies the target application and determines what libraries are being used. 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. 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.

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

• Authorization: Execute Unauthorized Commands • 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.

Related

Att&ck technique · MITRE ATT&CK (1)

  • T1574.008 Path Interception by Search Order Hijacking sub-technique

Can precede · CAPEC (1)

  • CAPEC-185 Malicious Software Download attack pattern

Child of · CAPEC (1)

  • CAPEC-154 Resource Location Spoofing attack pattern

Weakness · CWE (1)

  • CWE-706 Use of Incorrectly-Resolved Name or Reference weakness

Referenced by CAPEC · child of (4)

  • CAPEC-132 Symlink Attack attack pattern
  • CAPEC-38 Leveraging/Manipulating Configuration File Search Paths attack pattern
  • CAPEC-471 Search Order Hijacking attack pattern
  • CAPEC-641 DLL Side-Loading attack pattern

Referenced by CWE · attack pattern (1)

  • CWE-706 Use of Incorrectly-Resolved Name or Reference weakness