CWE-670: Always-Incorrect Control Flow Implementation
CWE版本: 4.18
更新日期: 2025-09-09
弱点描述
The code contains a control flow path that does not reflect the algorithm that the path is intended to implement, leading to incorrect behavior any time this path is navigated.
扩展描述
This weakness captures cases in which a particular code segment is always incorrect with respect to the algorithm that it is implementing. For example, if a C programmer intends to include multiple statements in a single block but does not include the enclosing braces (CWE-483), then the logic is always incorrect. This issue is in contrast to most weaknesses in which the code usually behaves correctly, except when it is externally manipulated in malicious ways.
常见后果
影响范围: Other
技术影响: Other Alter Execution Logic
观察示例
参考: CVE-2021-3011
virtual interrupt controller in a virtualization product allows crash of host by writing a certain invalid value to a register, which triggers a fatal error instead of returning an error code
引入模式
| 阶段 | 说明 |
|---|---|
| Implementation | This issue typically appears in rarely-tested code, since the "always-incorrect" nature will be detected as a bug during normal usage. |