Trusted Design

T1034 - Path Interception

概要

This technique has been deprecated. Please use Path Interception by PATH Environment Variable, Path Interception by Search Order Hijacking, and/or Path Interception by Unquoted Path.

Path interception occurs when an executable is placed in a specific path so that it is executed by an application instead of the intended target. One example of this was the use of a copy of cmd in the current working directory of a vulnerable application that loads a CMD or BAT file with the CreateProcess function. (Citation: TechNet MS14-019)

There are multiple distinct weaknesses or misconfigurations that adversaries may take advantage of when performing path interception: unquoted paths, path environment variable misconfigurations, and search order hijacking. The first vulnerability deals with full program paths, while the second and third occur when program paths are not specified. These techniques can be used for persistence if executables are called on a regular basis, as well as privilege escalation if intercepted executables are started by a higher privileged process.

Unquoted Paths

Service paths (stored in Windows Registry keys) (Citation: Microsoft Subkey) and shortcut paths are vulnerable to path interception if the path has one or more spaces and is not surrounded by quotation marks (e.g., C:\unsafe path with space\program.exe vs. "C:\safe path with space\program.exe"). (Citation: Baggett 2012) An adversary can place an executable in a higher level directory of the path, and Windows will resolve that executable instead of the intended executable. For example, if the path in a shortcut is C:\program files\myapp.exe, an adversary may create a program at C:\program.exe that will be run instead of the intended program. (Citation: SecurityBoulevard Unquoted Services APR 2018) (Citation: SploitSpren Windows Priv Jan 2018)

PATH Environment Variable Misconfiguration

The PATH environment variable contains a list of directories. Certain methods of executing a program (namely using cmd.exe or the command-line) rely solely on the PATH environment variable to determine the locations that are searched for a program when the path for the program is not given. If any directories are listed in the PATH environment variable before the Windows directory, %SystemRoot%\system32 (e.g., C:\Windows\system32), a program may be placed in the preceding directory that is named the same as a Windows program (such as cmd, PowerShell, or Python), which will be executed when that command is executed from a script or command-line.

For example, if C:\example path precedes C:\Windows\system32 is in the PATH environment variable, a program that is named net.exe and placed in C:\example path will be called instead of the Windows system "net" when "net" is executed from the command-line.

Search Order Hijacking

Search order hijacking occurs when an adversary abuses the order in which Windows searches for programs that are not given a path. The search order differs depending on the method that is used to execute the program. (Citation: Microsoft CreateProcess) (Citation: Hill NT Shell) (Citation: Microsoft WinExec) However, it is common for Windows to search in the directory of the initiating program before searching through the Windows system directory. An adversary who finds a program vulnerable to search order hijacking (i.e., a program that does not specify the path to an executable) may take advantage of this vulnerability by creating a program named after the improperly specified program and placing it within the initiating program's directory.

For example, "example.exe" runs "cmd.exe" with the command-line argument net user. An adversary may place a program called "net.exe" within the same directory as example.exe, "net.exe" will be run instead of the Windows system utility net. In addition, if an adversary places a program called "net.com" in the same directory as "net.exe", then cmd.exe /C net user will execute "net.com" instead of "net.exe" due to the order of executable extensions defined under PATHEXT. (Citation: MSDN Environment Property)

Search order hijacking is also a common practice for hijacking DLL loads and is covered in DLL Search Order Hijacking.

管理者によるコメント

T1034「Path Interception」(パスの横取り) は、OSがプログラムを起動する際の「ファイルパスの指定や検索順序」の不備を突き、正規のプログラムの代わりに悪意のあるファイルをOSに実行させる手法です。

この手法は「永続化(Persistence)」と「特権昇格(Privilege Escalation)」の目的で広く利用されます。

1. 概要

この手法で攻撃者は、「システムや正規のアプリが持つ起動権限を悪用し、自分のコードを身代わりとして実行させる」ことを実現します。

何を実現できるのか:

2. 攻撃の流れ

最も代表的な 「引用符で囲まれていないサービスパス(Unquoted Service Path)」 の例を挙げます。

  1. 脆弱なサービスの特定:
    パスにスペース(空白)が含まれており、かつ引用符(")で囲まれていないサービスを探します。

    • 例: C:\Program Files\My Service\Launcher.exe
  2. 実行ファイルの配置:
    Windowsはパスを解釈する際、前から順に「実行ファイルを探す」挙動をとります。攻撃者は以下のような場所にマルウェアを配置します。

    • C:\Program.exe
    • C:\Program Files\My.exe
  3. 横取り:
    システムが Launcher.exe を起動しようとすると、Windowsは正規のファイルを探しに行く前に、先に見つけた C:\Program.exe を先に実行してしまいます。

3. 防御・対策

設定の不備を修正し、アクセス権を厳格にすることが鍵です。

4. 重要ポイント

5. 関連する主なCWE

6. 関連する代表的なCVE

特定の製品でこの設定不備が見つかった際、CVEとして公開されることがあります。

実務上のアドバイス

コマンドプロンプトで以下のコマンドを実行すると、引用符で囲まれていない怪しいサービスをリストアップできます。一度自社の環境で確認することをお勧めします。

wmic service get name,displayname,pathname,startmode | findstr /i "auto" | findstr /i /v "c:\windows\\" | findstr /i /v """

分析

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

関連する CVE

この攻撃手法に関連する CVE は登録されていません。

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


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