CWE一覧に戻る
CWE-478

複数条件式でデフォルト・ケースが見つからない

Missing Default Case in Multiple Condition Expression
脆弱性 レビュー中
JA

switch文のような複数の条件を持つ式では、コードにデフォルトのケースはありません。

C言語のswitchのような)複数条件式がデフォルトのケースを省いているにもかかわらず、起こりうるすべての値を考慮したり処理したりしない場合、複雑な論理エラーや結果的な弱点につながる可能性がある。このため、乏しい情報に基づいてさらなる判断が下され、失敗が連鎖する。この連鎖的な失敗は、いくつものセキュ リティ問題を引き起こす可能性があり、システムにおける重大な失敗を構成する。

EN

The code does not have a default case in an expression with multiple conditions, such as a switch statement.

If a multiple-condition expression (such as a switch in C) omits the default case but does not consider or handle all possible values that could occur, then this might lead to complex logical errors and resultant weaknesses. Because of this, further decisions are made based on poor information, and cascading failure results. This cascading failure may result in any number of security issues, and constitutes a significant failure in the system.

Scope: Integrity / Impact: Varies by Context; Alter Execution Logic
Ensure that there are no cases unaccounted for when adjusting program flow or values based on the value of a given variable. In the case of switch style statements, the very simple act of creating a default case can, if done correctly, mitigate this situation. Often however, the default case is used simply to represent an assumed option, as opposed to working as a check for invalid input. This is poor practice and in some cases is as bad as omitting a default case entirely.
MITRE公式ページ — CWE-478