Dark Mode

Settings

Capec-159 Detail

Redirect Access to Libraries

Standard Software Likelihood: High Typical Severity: Very High

Parents: 154

Children: 38 132 471 641

Threats: T79 T287 T337 T391 T406

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.

Not present

External ID Source Link Description
CAPEC-159 capec https://capec.mitre.org/data/definitions/159.html
CWE-706 cwe http://cwe.mitre.org/data/definitions/706.html
T1574.008 ATTACK https://attack.mitre.org/wiki/Technique/T1574/008 Hijack Execution Flow:Path Interception by Search Order Hijacking
REF-29 reference_from_CAPEC http://phrack.org/issues/56/7.html Silvio Cesare, Share Library Call Redirection Via ELF PLT Infection (Issue 56), Phrack Magazine, 2000
REF-30 reference_from_CAPEC https://www.owasp.org/www-pdf-archive/OWASP_Top_10_2007.pdf OWASP Top 10 2007 (2007), The Open Web Application Security Project (OWASP)
Explore
  1. Identify Target: The adversary identifies the target application and determines what libraries are being used.

  2. Techniques
    Find public source code and identify library dependencies.
    Gain access to the system hosting the application and look for libraries in common locations.
Experiment
  1. 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.

Exploit
  1. 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.

  2. Techniques
    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.
  1. The target must utilize external libraries and must fail to verify the integrity of these libraries before using them.

Not present

Low High Medium
To modify the entries in the configuration file pointing to malicious libraries
To reverse engineering the libraries and inject malicious code into the libraries
To force symlink and timing issues for redirecting access to libraries
Authorization Access Control
Execute Unauthorized Commands (Run Arbitrary Code) Bypass Protection Mechanism
Bypass Protection Mechanism
  1. 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