Home > CAPEC List > CAPEC-159: Redirect Access to Libraries (Version 2.10)  

CAPEC-159: Redirect Access to Libraries

 
Redirect Access to Libraries
Definition in a New Window Definition in a New Window
Attack Pattern ID: 159
Abstraction: Standard
Status: Draft
Completeness: Complete
Presentation Filter:
+ Summary

An attacker exploits the execution flow of a call to an external library to point to an attacker supplied library or code base, allowing the attacker 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 attacker can redirect an application's attempts to access these libraries to other libraries that the attacker supplies, the attacker 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.

+ Attack Execution Flow
Explore
  1. 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.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    The attacker uses a tool such as the OSX "otool" utility or manually probes whether the target application uses dynamically linked libraries.

    env-Local
    2

    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.

    env-Local

    Indicators

    IDTypeIndicator DescriptionEnvironments
    1Positive

    The target application uses dynamically linked libraries.

    env-Local
    2Positive

    The attacker can redirect or control access to files in areas leveraged by the target.

    env-Local
    3Positive

    The attacker can modify the entries in the configuration files to the libraries the attacker crafted.

    env-Local
    4Inconclusive

    The attacker cannot modify the configuration files entries. The attacker may still be able to redirect access to libraries using other techniques such as using symbolic links.

    env-Local
    5Negative

    The application does not use dynamically linked libraries.

    env-Local

    Outcomes

    IDTypeOutcome Description
    1Success
    The attacker can successfully redirect or control access to libraries leveraged by the target.
    2Success
    The attacker identifies and gains control of the configuration file containing entries of a list of dynamically linked libraries and be able to modify the entry to point to the malicious libraries the attacker created.

    Security Controls

    IDTypeSecurity Control Description
    1Preventative
    Restrict the permission to modify the entries in the configuration file.
Experiment
  1. Craft malicious libraries:

    The attacker uses knowledge gained in the Explore phase to craft malicious libraries that he will redirect the target to leverage. These malicious libraries could have the same APIs as the legitimate library and additional malicious code.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironments
    1

    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.

    env-Local

    Outcomes

    IDTypeOutcome Description
    1Success
    The entries in the configuration file points to the malicious libraries he crafted.

    Security Controls

    IDTypeSecurity Control Description
    1Preventative
    Restrict the permission to modify the entries in the configuration file.
    2Preventative
    If possible, use obfuscation and other techniques to prevent reverse engineering the libraries.
Exploit
  1. Redirect the access to libraries to the malicious libraries:

    The attacker redirects the target to the malicious libraries he 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.

    Attack Step Techniques

    IDAttack Step Technique DescriptionEnvironmentsLeveraged Attack Patterns
    1

    The attacker modifies the entries in the configuration files pointing to the malicious libraries he crafted.

    env-Local
    2

    The attacker leverages symlink/timing issues to redirect the target to access the malicious libraries he crafted.

    env-Local
    • 132
    3

    The attacker leverages file search path order issues to redirect the target to access the malicious libraries he crafted.

    env-Local
    • 38

    Outcomes

    IDTypeOutcome Description
    1Success
    The application is redirected to the malicious libraries the attacker crafted when the application attempts to call the legitimate libraries.

    Security Controls

    IDTypeSecurity Control Description
    1Preventative
    Restrict the permission to modify the entries in the configuration file.
    2Preventative
    Check the integrity of the dynamically linked libraries before using them.
    3Preventative
    If possible, use obfuscation and other techniques to prevent reverse engineering the libraries.
+ Attack Prerequisites
  • The target must utilize external libraries and must fail to verify the integrity of these libraries before using them.

+ Typical Severity

Very High

+ Typical Likelihood of Exploit

Likelihood: High

+ Methods of Attack
  • Modification of Resources
  • Injection
  • API Abuse
+ Examples-Instances

Description

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

+ Attacker Skills or Knowledge Required

Skill or Knowledge Level: Low

To modify the entries in the configuration file pointing to malicious libraries

Skill or Knowledge Level: Medium

To force symlink and timing issues for redirecting access to libraries

Skill or Knowledge Level: High

To reverse engineering the libraries and inject malicious code into the libraries

+ Solutions and 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.

+ Attack Motivation-Consequences
ScopeTechnical ImpactNote
Authorization
Execute unauthorized code or commands
Run Arbitrary Code
Access_Control
Authorization
Bypass protection mechanism
+ Purposes
  • Exploitation
  • Penetration
+ CIA Impact
Confidentiality Impact: HighIntegrity Impact: HighAvailability Impact: High
+ Technical Context
Architectural Paradigms
Client-Server
Frameworks
All
Platforms
All
Languages
All
+ References
[R.159.1] [REF-11] Silvio Cesare. "Share Library Call Redirection Via ELF PLT Infection". Issue 56. Phrack Magazine. 2000. <http://www.phrack.org/issues.html?issue=56&id=7>.
[R.159.2] [REF-8] "OWASP Top 10". Top 10 2007 - Malicious File Execution. 2007. The Open Web Application Security Project (OWASP). <https://www.owasp.org/index.php/Top_10_2007-A3>.
[R.159.3] ATT&CK Project. "Path Interception (1034)". MITRE. <https://attack.mitre.org/wiki/Path_interception>.
+ Content History
Submissions
SubmitterOrganizationDateSource
CAPEC Content TeamThe MITRE Corporation2014-06-23Internal_CAPEC_Team
Modifications
ModifierOrganizationDateCommentsSource
CAPEC Content TeamThe MITRE Corporation2015-11-09Updated ReferencesInternal
More information is available — Please select a different filter.
Page Last Updated or Reviewed: May 01, 2017