CWE一覧に戻る
CWE-641

ファイルやその他のリソースの名前の不適切な制限

Improper Restriction of Names for Files and Other Resources
脆弱性 作成中
JA

この製品は、上流のコンポーネントからの入力を使用してファイルまたはその他のリソースの名前を作成しますが、結果の名前を制限していないか、間違って制限しています。

その結果、弱点が生じる可能性があります。例えば、これらのリソースの名前にスクリプト文字が含まれている場合、動的に生成されたウェブページでアプリケーションがリソースの名前を表示すると、クライアントのブラウザでスクリプトが実行される可能性があります。あるいは、リソースが何らかのアプリケーション・パーサによって消費される場合、特別に細工された名前がパーサ内部の脆弱性を悪用し、サーバ・マシン上で任意のコードが実行される可能性があります。問題は、そのような不正なリソース名の使用状況や、コード実行を可能にする脆弱性が存在するか、ターゲットとなる技術によって仮定されているかによって異なります。

EN

The product constructs the name of a file or other resource using input from an upstream component, but it does not restrict or incorrectly restricts the resulting name.

This may produce resultant weaknesses. For instance, if the names of these resources contain scripting characters, it is possible that a script may get executed in the client's browser if the application ever displays the name of the resource on a dynamically generated web page. Alternately, if the resources are consumed by some application parser, a specially crafted name can exploit some vulnerability internal to the parser, potentially resulting in execution of arbitrary code on the server machine. The problems will vary based on the context of usage of such malformed resource names and whether vulnerabilities are present in or assumptions are made by the targeted technology that would make code execution possible.

Scope: Integrity, Confidentiality, Availability / Impact: Execute Unauthorized Code or Commands
Scope: Confidentiality, Availability / Impact: Read Application Data; DoS: Crash, Exit, or Restart
Do not allow users to control names of resources used on the server side.
Perform allowlist input validation at entry points and also before consuming the resources. Reject bad file names rather than trying to cleanse them.
Make sure that technologies consuming the resources are not vulnerable (e.g. buffer overflow, format string, etc.) in a way that would allow code execution if the name of the resource is malformed.
MITRE公式ページ — CWE-641