CWE Reference
CWE-755: Improper Handling of Exceptional Conditions
Official CWE-755 CWE context with Glexia analysis, remediation guidance, related CVEs, and ATT&CK context.
Release 4.20weaknessIncomplete
Glexia's Take
CWE-755: Improper Handling of Exceptional Conditions
Improper Handling of Exceptional Conditions represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Executive Impact
- Other: Other
Developer Pattern
CWE-755 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.
Confidence
high confidence from CWE-755, 4.20.
Official CWE Definition
CWE-755: Improper Handling of Exceptional Conditions
The product does not handle or incorrectly handles an exceptional condition.
Developer And Remediation Guidance
How teams prevent and detect this weakness
Causes
- The following example attempts to resolve a hostname. A DNS lookup failure will cause the Servlet to throw an exception.
- 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. 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.
- The following code mistakenly catches a NullPointerException.
Remediation
- Use safe APIs
- Centralize the control
- Add regression tests
- Review logs and telemetry for attempted abuse
Detection
- Automated Static Analysis: Automated static analysis, commonly referred to as Static Application Security Testing (SAST), can find some instances of this weakness by analyzing source code (or binary/compiled code) without having to execute it. Typically, this is done by building a model of data flow and control flow, then searching for potentially-vulnerable patterns that connect "sources" (origins of input) with "sinks" (destinations where the data interacts with external components, a lower layer such as the OS, etc.)
Mappings
Related CVEs, CWEs, and ATT&CK context
Related CWEs
- CWE-209: Generation of Error Message Containing Sensitive Information
- CWE-248: Uncaught Exception
- CWE-274: Improper Handling of Insufficient Privileges
- CWE-280: Improper Handling of Insufficient Permissions or Privileges
- CWE-333: Improper Handling of Insufficient Entropy in TRNG
- CWE-390: Detection of Error Condition Without Action
- CWE-392: Missing Report of Error Condition
- CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference
- CWE-396: Declaration of Catch for Generic Exception
- CWE-460: Improper Cleanup on Thrown Exception
- CWE-544: Missing Standardized Error Handling Mechanism
- CWE-636: Not Failing Securely ('Failing Open')
ATT&CK Relevance
ATT&CK relevance is shown only when reviewed or responsibly inferred.