CWE
Home > CWE List > CWE-390 Individual Dictionary Definition (Draft 9)   View the CWE List

CWE-390 Individual Dictionary Definition (Draft 9)

Detection of Error Condition Without Action
Weakness ID
Status: Draft

390 (Weakness Class)

Description

Summary

Sometimes an error is detected, and bad or no action is taken.

Likelihood of Exploit

Medium

Potential Mitigations

Implementation: Properly handle each exception. This is the recommended solution. Ensure that all exceptions are handled in such a way that you can be sure of the state of your system at any given moment.

Subject the software to extensive testing to discover some of the possible instances of where/how errors or return values are not handled. Consider testing techniques such as ad hoc, equivalence partitioning, robustness and fault tolerance, mutation, and fuzzing.

Demonstrative
Examples

C Example:

foo=malloc(sizeof(char); //the next line checks to see if malloc failed
if (foo==0) {
  //We do nothing so we just ignore the error.
}

C++ Example:

while (DoSomething()) {
  try {
    /* perform main loop here */
  }
  catch (Exception e) {
    /* do nothing, but catch so it'll compile... */
  }
}

Java Example:

while (DoSomething()) {
  try {
    /* perform main loop here */
  }
  catch (Exception e) {
    /* do nothing, but catch so it'll compile... */
  }
}

Context Notes

If a function returns an error, it is important to either fix the problem and try again, alert the user that an error has happened and let the program continue, or alert the user and close and cleanup the program.

Relationships
NatureTypeIDName
ChildOfCategoryCategory389Error Conditions, Return Values, Status Codes
CanPrecedeWeakness BaseWeakness BaseWeakness Base401Failure to Release Memory Before Removing Last Reference (aka 'Memory Leak')
PeerOfWeakness BaseWeakness BaseWeakness Base600Failure to Catch All Exceptions (Missing Catch Block)
CanAlsoBeWeakness VariantWeakness VariantWeakness Variant81Failure to Sanitize Directives in an Error Message Web Page
Source Taxonomies

CLASP - Improper error handling

Applicable Platforms

All

Related Attack Patterns
CAPEC-IDAttack Pattern Name
83XPath Injection
66SQL Injection
7Blind SQL Injection
Page Last Updated: April 22, 2008