Improper Handling of Exceptional Conditions

Incomplete Class
Structure: Simple
Description

The product does not handle or incorrectly handles an exceptional condition.

Common Consequences 1
Scope: Other

Impact: Other

Demonstrative Examples 3

ID : DX-39

The following example attempts to resolve a hostname.

Code Example:

Bad
Java
java
A DNS lookup failure will cause the Servlet to throw an exception.

ID : DX-201

The following example attempts to allocate memory for a character. After the call to malloc, an if statement is used to check whether the malloc function failed.

Code Example:

Bad
C
c
The conditional successfully detects a NULL return value from malloc indicating a failure, however it does not do anything to handle the problem. Unhandled errors may have unexpected results and may cause the program to crash or terminate.
Instead, the if block should contain statements that either attempt to fix the problem or notify the user that an error has occurred and continue processing or perform some cleanup and gracefully terminate the program. The following example notifies the user that the malloc function did not allocate the required memory resources and returns an error code.

Code Example:

Good
C
c

ID : DX-202

The following code mistakenly catches a NullPointerException.

Code Example:

Bad
Java
java
Observed Examples 4
CVE-2023-41151SDK for OPC Unified Architecture (OPC UA) server has uncaught exception when a socket is blocked for writing but the server tries to send an error
[REF-1374]Chain: JavaScript-based cryptocurrency library can fall back to the insecure Math.random() function instead of reporting a failure (Missing Report of Error Condition), thus reducing the entropy (Insufficient Entropy in PRNG) and leading to generation of non-unique cryptographic keys for Bitcoin wallets (Use of Weak Credentials)
CVE-2021-3011virtual 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
CVE-2008-4302Chain: OS kernel does not properly handle a failure of a function call (Improper Handling of Exceptional Conditions), leading to an unlock of a resource that was not locked (Unlock of a Resource that is not Locked), with resultant crash.
References 1
Randstorm: You Can't Patch a House of Cards
Unciphered
14-11-2023
ID: REF-1374
Likelihood of Exploit

Medium

Applicable Platforms
Languages:
Not Language-Specific : Undetermined
Modes of Introduction
Implementation