Trusted Design

T1038 - DLL Search Order Hijacking

概要

Windows systems use a common method to look for required DLLs to load into a program. (Citation: Microsoft DLL Search) Adversaries may take advantage of the Windows DLL search order and programs that ambiguously specify DLLs to gain privilege escalation and persistence.

Adversaries may perform DLL preloading, also called binary planting attacks, (Citation: OWASP Binary Planting) by placing a malicious DLL with the same name as an ambiguously specified DLL in a location that Windows searches before the legitimate DLL. Often this location is the current working directory of the program. Remote DLL preloading attacks occur when a program sets its current directory to a remote location such as a Web share before loading a DLL. (Citation: Microsoft 2269637) Adversaries may use this behavior to cause the program to load a malicious DLL.

Adversaries may also directly modify the way a program loads DLLs by replacing an existing DLL or modifying a .manifest or .local redirection file, directory, or junction to cause the program to load a different DLL to maintain persistence or privilege escalation. (Citation: Microsoft DLL Redirection) (Citation: Microsoft Manifests) (Citation: Mandiant Search Order)

If a search order-vulnerable program is configured to run at a higher privilege level, then the adversary-controlled DLL that is loaded will also be executed at the higher level. In this case, the technique could be used for privilege escalation from user to administrator or SYSTEM or from administrator to SYSTEM, depending on the program.

Programs that fall victim to path hijacking may appear to behave normally because malicious DLLs may be configured to also load the legitimate DLLs they were meant to replace.

管理者によるコメント

T1038「DLL Search Order Hijacking」(DLL検索順序の乗っ取り) は、Windows OSがプログラム実行時に必要なDLL(動的リンクライブラリ)を検索する際の「優先順位」を悪用して、正規のDLLの代わりに悪意のあるDLLを読み込ませる手法です。

この手法は「永続化(Persistence)」と「特権昇格(Privilege Escalation)」によく使われます。

1. 概要

この手法で攻撃者は、「正規のアプリケーションを起動するだけで、自動的にマルウェアをシステムにロードさせること」を実現します。

何を実現できるのか

2. 攻撃の流れ

WindowsにはDLLを探す標準的な順番(検索順序)があります。攻撃者はこれを利用します。

  1. 検索順序の把握: 通常、Windowsは以下の順でDLLを探します。

    1. アプリケーションがロードされたディレクトリ(ここが最大の標的
    2. システムディレクトリ(C:\Windows\System32
    3. 16ビットシステムディレクトリ
    4. Windowsディレクトリ
    5. カレントディレクトリ
    6. PATH環境変数に設定されたディレクトリ
  2. 脆弱なアプリの特定:
    システムディレクトリ(System32)にあるはずのDLLを、自身のインストールフォルダから先に探そうとするアプリを見つけます。

  3. 悪意のあるDLLの配置:
    正規のDLLと同じ名前(例:version.dll, dwmapi.dll など)でマルウェアを偽装し、アプリケーションと同じフォルダに配置します。

  4. 実行:
    ユーザーがアプリを起動すると、OSはSystem32を見に行く前に、同じフォルダにある攻撃者のDLLを「必要なファイル」として読み込んでしまいます。

3. 防御・対策

「DLLの読み込み制限」と「フォルダ権限の管理」が重要です。

4. 重要ポイント

5. 関連する主なCWE

6. 関連する代表的なCVE

多くの有名ソフトウェアが過去にこの脆弱性を指摘されています。

実務上のアドバイス

特定のアプリを起動したときに、本来 System32 から読み込まれるべきDLLが、なぜかそのアプリのインストールフォルダ(例:Downloads フォルダなど)から読み込まれていないかを監視することが、この攻撃を検知する最も効果的な方法です。

分析

この攻撃手法を利用する脅威アクター

関連する CVE

攻撃手法 – 脅威アクター Graph


← Technique一覧に戻る ← Tactics一覧に戻る