CWE-369: Divide By Zero

Base Draft Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

The product divides a value by zero.

扩展描述

This weakness typically occurs when an unexpected value is provided to the product, or if an error occurs that is not properly detected. It frequently occurs in calculations involving physical dimensions such as size, length, width, and height.

常见后果

影响范围: Availability

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

说明: A Divide by Zero results in a crash.

检测方法

方法: Automated Static Analysis

Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)

有效性: High

方法: Fuzzing

Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.

有效性: High

观察示例

参考: CVE-2007-3268

Invalid size value leads to divide by zero.

参考: CVE-2007-2723

"Empty" content triggers divide by zero.

参考: CVE-2007-2237

Height value of 0 triggers divide by zero.

引入模式

阶段 说明
Implementation -

分类映射

分类名称 条目ID 条目名称 映射适配度
OWASP Top Ten 2004 A9 Denial of Service CWE More Specific
CERT C Secure Coding FLP03-C Detect and handle floating point errors -
CERT C Secure Coding INT33-C Ensure that division and remainder operations do not result in divide-by-zero errors Exact
The CERT Oracle Secure Coding Standard for Java (2011) NUM02-J Ensure that division and modulo operations do not result in divide-by-zero errors -
Software Fault Patterns SFP1 Glitch in computation -
关键信息

CWE ID: CWE-369

抽象级别: Base

结构: Simple

状态: Draft

利用可能性: Medium

相关弱点