The code does not sufficiently manage its control flow during execution, creating conditions in which the control flow can be modified in unexpected ways.

Primary

Architecture and Design

Implementation

Other
Alter Execution Logic

The following function attempts to acquire a lock in order to perform operations on a shared resource.

void f(pthread_mutex_t *mutex) {
pthread_mutex_lock(mutex);

/* access shared resource */

pthread_mutex_unlock(mutex);
}

However, the code does not check the value returned by pthread_mutex_lock() for errors. If pthread_mutex_lock() cannot acquire the mutex for any reason, the function may introduce a race condition into the program and result in undefined behavior.
In order to avoid data races, correctly written programs must check the result of thread synchronization functions and appropriately handle all errors, either by attempting to recover from them or reporting them to higher levels.

int f(pthread_mutex_t *mutex) {
int result;
result = pthread_mutex_lock(mutex);if (0 != result)return result;

/* access shared resource */

return pthread_mutex_unlock(mutex);
}

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.

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.

This function prints the contents of a specified file requested by a user.

function printFile($username,$filename){

//read file into string
$file = file_get_contents($filename);if ($file && isOwnerOf($username,$filename)){echo $file;return true;}else{echo 'You are not authorized to view this file';}return false;
}

This code first reads a specified file into memory, then prints the file if the user is authorized to see its contents. The read of the file into memory may be resource intensive and is unnecessary if the user is not allowed to see the file anyway.

CVE-2024-50653
e-commerce product does not restrict the number of requests for coupons
https://www.cve.org/CVERecord?id=CVE-2024-50653

CVE-2019-9805
Chain: Creation of the packet client occurs before initialization is complete (CWE-696) resulting in a read from uninitialized memory (CWE-908), causing memory corruption.
https://www.cve.org/CVERecord?id=CVE-2019-9805

CVE-2014-1266
Chain: incorrect "goto" in Apple SSL product bypasses certificate validation, allowing Adversary-in-the-Middle (AITM) attack (Apple "goto fail" bug). CWE-705 (Incorrect Control Flow Scoping) -> CWE-561 (Dead Code) -> CWE-295 (Improper Certificate Validation) -> CWE-393 (Return of Wrong Status Code) -> CWE-300 (Channel Accessible by Non-Endpoint). The code's whitespace indentation did not reflect the actual control flow (CWE-1114) and did not explicitly delimit the block (CWE-483), which could have made it more difficult for human code auditors to detect the vulnerability.
https://www.cve.org/CVERecord?id=CVE-2014-1266

CVE-2011-1027
Chain: off-by-one error (CWE-193) leads to infinite loop (CWE-835) using invalid hex-encoded characters.
https://www.cve.org/CVERecord?id=CVE-2011-1027

40
Insufficient Process Validation

Discouraged
This CWE entry is extremely high-level, a Pillar. However, classification research is limited for weaknesses of this type, so there can be gaps or organizational difficulties within CWE that force use of this weakness, even at such a high level of abstraction.
Where feasible, consider children or descendants of this entry instead.

CWE Content Team
MITRE
2008-04-11
Draft 9
2008-04-11

Eric Dalci
Cigital
2008-07-01
updated Time_of_Introduction

CWE Content Team
MITRE
2008-09-08
updated Relationships, Other_Notes

CWE Content Team
MITRE
2008-11-24
updated Relationships

CWE Content Team
MITRE
2009-03-10
updated Related_Attack_Patterns

CWE Content Team
MITRE
2009-05-27
updated Relationships

CWE Content Team
MITRE
2010-02-16
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2010-09-27
updated Relationships

CWE Content Team
MITRE
2010-12-13
updated Relationships

CWE Content Team
MITRE
2011-03-29
updated Maintenance_Notes, Other_Notes, Relationships

CWE Content Team
MITRE
2011-06-01
updated Common_Consequences

CWE Content Team
MITRE
2012-05-11
updated Relationships

CWE Content Team
MITRE
2014-07-30
updated Relationships

CWE Content Team
MITRE
2017-01-19
updated Relationships

CWE Content Team
MITRE
2017-11-08
updated Applicable_Platforms, Relationships, Relevant_Properties

CWE Content Team
MITRE
2020-02-24
updated Applicable_Platforms, Type

CWE Content Team
MITRE
2020-06-25
updated Relationships

CWE Content Team
MITRE
2021-03-15
updated Maintenance_Notes

CWE Content Team
MITRE
2023-01-31
updated Relationships

CWE Content Team
MITRE
2023-04-27
updated Relationships

CWE Content Team
MITRE
2023-06-29
updated Mapping_Notes

CWE Content Team
MITRE
2023-10-26
updated Observed_Examples, Relationships

CWE Content Team
MITRE
2024-02-29
4.14
2024-02-29
updated Demonstrative_Examples

CWE Content Team
MITRE
2025-04-03
4.17
2025-04-03
updated Relationships

CWE Content Team
MITRE
2025-09-09
4.18
2025-09-09
updated Relationships

CWE Content Team
MITRE
2025-12-11
4.19
2025-12-11
updated Observed_Examples, Relationships, Weakness_Ordinalities