この製品は、リソースを見つけるために固定または制御された検索パスを使用するが、そのパス内の1つまたは複数の場所が、意図しないアクターの制御下にある可能性がある。
この弱点はどのようなタイプのリソースでも発生する可能性があるが、製品が実行可能ファイルやコード・ライブラリを検索するためにディレクトリ検索パスを使用しているにもかかわらず、そのパスに"/tmp "や現在の作業ディレクトリなど、攻撃者が変更可能なディレクトリが含まれている場合に頻繁に発生する。
Windowsベースのシステムでは、LoadLibraryまたはLoadLibraryEx関数が、完全修飾パスを含まないDLL名で呼び出された場合、関数は、制御できない可能性のある2つのパス要素を含む検索順序に従います:
場合によっては、SMB や WebDAV ネットワーク共有が使用されている場合など、リモートから攻撃を行うことができます。
このパスの1つ以上の場所には、Windowsドライブのルートやそのサブディレクトリが含まれる可能性がある。Linuxベースのコードでは、ルートディレクトリ(/)やそのサブディレクトリ(/etcなど)の制御された性質や、親ディレクトリに再帰的にアクセスするコードを想定して、このようなコードが存在することが多い。 Windowsでは、ドライブのルートとそのサブディレクトリのいくつかは、デフォルトで弱いパーミッションを持っており、制御不能になっている。
Unixベースのシステムでは、PATHに空の変数をスプライスするなどして、空の要素を含むPATHが作成されることがある。この空の要素は、現在の作業ディレクトリと同じと解釈される可能性があり、信頼できない検索要素になる可能性があります。
ソフトウェアパッケージ管理フレームワーク(npm、RubyGems、PyPiなど)では、サードパーティのライブラリや他のパッケージの依存関係を特定し、目的のパッケージを含むリポジトリを参照することがあります。フレームワークはプライベートリポジトリの前にパブリックリポジトリを検索するかもしれません。これは、プライベートリポジトリのパッケージと同じ名前を持つ悪意のあるパッケージをパブリックリポジトリに置くことで、攻撃者に悪用される可能性があります。検索パスはフレームワークに依存する開発者の直接の制御下にないかもしれませんが、この検索順序は事実上信頼されない要素を含んでいます。
The product uses a fixed or controlled search path to find resources, but one or more locations in that path can be under the control of unintended actors.
Although this weakness can occur with any type of resource, it is frequently introduced when a product uses a directory search path to find executables or code libraries, but the path contains a directory that can be modified by an attacker, such as "/tmp" or the current working directory.
In Windows-based systems, when the LoadLibrary or LoadLibraryEx function is called with a DLL name that does not contain a fully qualified path, the function follows a search order that includes two path elements that might be uncontrolled:
In some cases, the attack can be conducted remotely, such as when SMB or WebDAV network shares are used.
One or more locations in that path could include the Windows drive root or its subdirectories. This often exists in Linux-based code assuming the controlled nature of the root directory (/) or its subdirectories (/etc, etc), or a code that recursively accesses the parent directory. In Windows, the drive root and some of its subdirectories have weak permissions by default, which makes them uncontrolled.
In some Unix-based systems, a PATH might be created that contains an empty element, e.g. by splicing an empty variable into the PATH. This empty element can be interpreted as equivalent to the current working directory, which might be an untrusted search element.
In software package management frameworks (e.g., npm, RubyGems, or PyPi), the framework may identify dependencies on third-party libraries or other packages, then consult a repository that contains the desired package. The framework may search a public repository before a private repository. This could be exploited by attackers by placing a malicious package in the public repository that has the same name as a package from the private repository. The search path might not be directly under control of the developer relying on the framework, but this search order effectively contains an untrusted element.