CWE一覧に戻る
CWE-470

クラスまたはコードを選択するための外部制御入力の使用(「安全でない反射)

Use of Externally-Controlled Input to Select Classes or Code ('Unsafe Reflection')
脆弱性 レビュー中
JA

この製品は、使用するクラスやコードを選択するためにリフレクションを使用した外部入力を使用するが、不適切なクラスやコードが選択されることを十分に防止していない。

どのクラスをインスタンス化するか、またはどのメソッドを呼び出すかを決定するために、製品が外部入力を使用する場合、攻撃者は予期しないクラスやメソッドを選択する値を提供する可能性があります。このような場合、攻撃者は開発者が意図していない制御フロー経路を作成する可能性があります。これらのパスは、認証やアクセス・コントロール・チェックを迂回したり、製品に予期せぬ動作をさせたりする可能性がある。攻撃者が製品のクラスパスに表示される場所にファイルをアップロードしたり(CWE-427)、製品のクラスパスに新しいエントリを追加したり(CWE-426)すると、この状況は破滅的なシナリオになります。これらの条件のいずれにおいても、攻撃者はリフレクションを使用して、製品に新たな悪意のある動作を導入することができます。

EN

The product uses external input with reflection to select which classes or code to use, but it does not sufficiently prevent the input from selecting improper classes or code.

If the product uses external inputs to determine which class to instantiate or which method to invoke, then an attacker could supply values to select unexpected classes or methods. If this occurs, then the attacker could create control flow paths that were not intended by the developer. These paths could bypass authentication or access control checks, or otherwise cause the product to behave in an unexpected manner. This situation becomes a doomsday scenario if the attacker can upload files into a location that appears on the product's classpath (CWE-427) or add new entries to the product's classpath (CWE-426). Under either of these conditions, the attacker can use reflection to introduce new, malicious behavior into the product.

Scope: Integrity, Confidentiality, Availability, Other / Impact: Execute Unauthorized Code or Commands; Alter Execution Logic
Scope: Availability, Other / Impact: DoS: Crash, Exit, or Restart; Other
Scope: Confidentiality / Impact: Read Application Data
Refactor your code to avoid using reflection.
Do not use user-controlled inputs to select and load classes or code.
Apply strict input validation by using allowlists or indirect selection to ensure that the user is only selecting allowable classes or code.
MITRE公式ページ — CWE-470