1476
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 691 Insufficient Control Flow Management 1517
ParentOf 480 Use of Incorrect Operator 1150
ParentOf 483 Incorrect Block Delimitation 1160
ParentOf 484 Omitted Break Statement in Switch 1162
ParentOf 617 Reachable Assertion 1378
ParentOf 698 Execution After Redirect (EAR) 1533
ParentOf 783 Operator Precedence Logic Error 1650
Relevant to the view "Weaknesses for Simplified Mapping of Published
Vulnerabilities" (CWE-1003)
Nature Type ID Name Page
ParentOf 617 Reachable Assertion 1378
Common Consequences
Scope Impact Likelihood
Other Other
Alter Execution Logic
Demonstrative Examples
Example 1:
This code queries a server and displays its status when a request comes from an authorized IP
address.
Example Language: PHP (Bad)
$requestingIP = $_SERVER['REMOTE_ADDR'];
if(!in_array($requestingIP,$ipAllowList)){
echo "You are not authorized to view this page";
http_redirect($errorPageURL);
}
$status = getServerStatus();
echo $status;
...
This code redirects unauthorized users, but continues to execute code after calling http_redirect().
This means even unauthorized users may be able to access the contents of the page or perform
a DoS attack on the server being queried. Also, note that this code is vulnerable to an IP address
spoofing attack (CWE-212).
Example 2:
In this example, the programmer has indented the statements to call Do_X() and Do_Y(), as if the
intention is that these functions are only called when the condition is true. However, because there
are no braces to signify the block, Do_Y() will always be executed, even if the condition is false.
Example Language: C (Bad)
if (condition==true)
Do_X();
Do_Y();
This might not be what the programmer intended. When the condition is critical for security, such as
in making a security decision or detecting a critical error, this may produce a vulnerability.
Example 3:
CWE Version 4.14
CWE-670: Always-Incorrect Control Flow Implementation
CWE-670: Always-Incorrect Control Flow Implementation