CWE-754: Improper Check for Unusual or Exceptional Conditions

Class Incomplete Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

The product does not check or incorrectly checks for unusual or exceptional conditions that are not expected to occur frequently during day to day operation of the product.

常见后果

影响范围: Integrity Availability

技术影响: DoS: Crash, Exit, or Restart Unexpected State

说明: The data which were produced as a result of a function call could be in a bad state upon return. If the return value is not checked, then this bad data may be used in operations, possibly leading to a crash or other unintended behaviors.

潜在缓解措施

阶段: Requirements

策略: Language Selection

阶段: Implementation

描述: Check the results of all functions that return a value and verify that the value is expected.

有效性: High

阶段: Implementation

描述: If using exception handling, catch and throw specific exceptions instead of overly-general exceptions (CWE-396, CWE-397). Catch and handle exceptions as locally as possible so that exceptions do not propagate too far up the call stack (CWE-705). Avoid unchecked or uncaught exceptions where feasible (CWE-248).

有效性: High

阶段: Implementation

阶段: Implementation

策略: Input Validation

阶段: Architecture and Design Implementation

描述: If the program must fail, ensure that it fails gracefully (fails closed). There may be a temptation to simply let the program fail poorly in cases such as low memory conditions, but an attacker may be able to assert control before the software has fully exited. Alternately, an uncontrolled failure could cause cascading problems with other downstream components; for example, the program could send a signal to a downstream process so the process immediately knows that a problem has occurred and has a better chance of recovery.

阶段: Architecture and Design

描述: Use system limits, which should help to prevent resource exhaustion. However, the product should still handle low resource conditions since they may still occur.

检测方法

方法: Automated Static Analysis

Automated static analysis may be useful for detecting unusual conditions involving system resources or common programming idioms, but not for violations of business rules.

有效性: Moderate

方法: Manual Dynamic Analysis

Identify error conditions that are not likely to occur during normal usage and trigger them. For example, run the program under low memory conditions, run with insufficient privileges or permissions, interrupt a transaction before it is completed, or disable connectivity to basic network services such as DNS. Monitor the software for any unexpected behavior. If you trigger an unhandled exception or similar error that was discovered and handled by the application's environment, it may still indicate unexpected conditions that were not handled by the application itself.

观察示例

参考: CVE-2023-49286

Chain: function in web caching proxy does not correctly check a return value (CWE-253) leading to a reachable assertion (CWE-617)

参考: CVE-2007-3798

Unchecked return value leads to resultant integer overflow and code execution.

参考: CVE-2006-4447

Program does not check return value when invoking functions to drop privileges, which could leave users with higher privileges than expected by forcing those functions to fail.

参考: CVE-2006-2916

Program does not check return value when invoking functions to drop privileges, which could leave users with higher privileges than expected by forcing those functions to fail.

引入模式

阶段 说明
Implementation REALIZATION: This weakness is caused during implementation of an architectural security tactic.

适用平台

编程语言
Not Language-Specific (Undetermined)

分类映射

分类名称 条目ID 条目名称 映射适配度
SEI CERT Perl Coding Standard EXP31-PL Do not suppress or ignore exceptions CWE More Abstract
ISA/IEC 62443 Part 4-2 Req CR 3.5 -
ISA/IEC 62443 Part 4-2 Req CR 3.7 -
关键信息

CWE ID: CWE-754

抽象级别: Class

结构: Simple

状态: Incomplete

利用可能性: Medium

相关弱点