CWE
Home > CWE List > CWE- Individual Dictionary Definition (1.0)  
Search by ID:

CWE-670: Always-Incorrect Control Flow Implementation

Individual Definition in a New Window
Always-Incorrect Control Flow Implementation
Status: Draft
Weakness ID: 670 (Weakness Class)
Description
Summary

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.

Extended Description

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 Notes

This issue typically appears in rarely-tested code, since the "always-incorrect" nature will be detected as a bug during normal usage.

This node could possibly be split into lower-level nodes. "Early Return" is for returning control to the caller too soon (e.g., CWE-584). "Excess Return" is when control is returned too far up the call stack (CWE-600, CWE-395). "Improper control limitation" occurs when the product maintains control at a lower level of execution, when control should be returned "further" up the call stack (CWE-455). "Incorrect syntax" covers code that's "just plain wrong" such as CWE-484 and CWE-483.

Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness ClassWeakness Class691Insufficient Control Flow Management
Research Concepts (primary)1000
ParentOfWeakness BaseWeakness BaseWeakness Base480Use of Incorrect Operator
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness VariantWeakness Variant483Incorrect Block Delimitation
Research Concepts (primary)1000
ParentOfWeakness BaseWeakness BaseWeakness Base484Omitted Break Statement
Research Concepts (primary)1000
ParentOfWeakness VariantWeakness VariantWeakness Variant617Reachable Assertion
Research Concepts (primary)1000
ParentOfWeakness BaseWeakness BaseWeakness Base698Redirect Without Exit
Research Concepts1000
Time of Introduction
* Architecture and Design
* Implementation
* Operation
Content History
Modifications
Eric Dalci. Cigital. 2008-07-01. (External)
updated Time_of_Introduction
CWE Content Team. MITRE. 2008-09-08. (Internal)
updated Description, Relationships, Other_Notes
Page Last Updated: September 10, 2008