CWE一覧に戻る
CWE-426

信頼できない検索パス

Untrusted Search Path
脆弱性 確定版
JA

製品は、外部から提供された検索パスを使用して重要なリソースを検索する。この検索パスは、製品の直接の管理下にないリソースを指すことがある。

これにより、攻撃者は独自のプログラムを実行したり、未承認のデータ・ファイルにアクセスしたり、予期せぬ方法で設定を変更したりできる可能性がある。製品がプログラムなどの重要なリソースを検索するために検索パスを使用している場合、攻撃者はその検索パスを悪意のあるプログラムを指すように変更することができ、標的となった製品はそのプログラムを実行することになる。この問題は、製品が信頼するあらゆる種類の重要なリソースに及ぶ。

信頼されていない検索パスの最も一般的な亜種には、以下のようなものがある:

EN

The product searches for critical resources using an externally-supplied search path that can point to resources that are not under the product's direct control.

This might allow attackers to execute their own programs, access unauthorized data files, or modify configuration in unexpected ways. If the product uses a search path to locate critical resources such as programs, then an attacker could modify that search path to point to a malicious program, which the targeted product would then execute. The problem extends to any type of critical resource that the product trusts.

Some of the most common variants of untrusted search path are:

Scope: Integrity, Confidentiality, Availability, Access Control / Impact: Gain Privileges or Assume Identity; Execute Unauthorized Code or Commands
Scope: Availability / Impact: DoS: Crash, Exit, or Restart
Scope: Confidentiality / Impact: Read Files or Directories
Hard-code the search path to a set of known-safe values (such as system directories), or only allow them to be specified by the administrator in a configuration file. Do not allow these settings to be modified by an external party. Be careful to avoid related weaknesses such as CWE-426 and CWE-428.
When invoking other programs, specify those programs using fully-qualified pathnames. While this is an effective approach, code that uses fully-qualified pathnames might not be portable to other systems that do not use the same pathnames. The portability can be improved by locating the full-qualified paths in a centralized, easily-modifiable location within the source code, and having the code refer to these paths.
Remove or restrict all environment settings before invoking other programs. This includes the PATH environment variable, LD_LIBRARY_PATH, and other settings that identify the location of code libraries, and any application-specific search paths.
Check your search path before use and remove any elements that are likely to be unsafe, such as the current working directory or a temporary files directory.
Use other functions that require explicit paths. Making use of any of the other readily available functions that require explicit paths is a safe way to avoid this problem. For example, system() in C does not require a full path since the shell can take care of it, while execl() and execv() require a full path.
MITRE公式ページ — CWE-426