CWE-396: Declaration of Catch for Generic Exception
ID
CWE-396
Abstraction
Base
Structure
Simple
Status
Draft
Catching overly broad exceptions promotes complex error handling code that is more likely to contain security vulnerabilities.
Multiple catch blocks can get ugly and repetitive, but "condensing" catch blocks by catching a high-level class like Exception can obscure exceptions that deserve special treatment or that should not be caught at this point in the program. Catching an overly broad exception essentially defeats the purpose of a language's typed exceptions, and can become particularly dangerous if the program grows and begins to throw new types of exceptions. The new exception types will not receive any attention.
Modes of Introduction
Phase | Note |
---|---|
Implementation |
Applicable Platforms
Type | Class | Name | Prevalence |
---|---|---|---|
Language | C++ | ||
Language | Java | ||
Language | C# | ||
Language | Python |
Relationships
View | Weakness | |||||||
---|---|---|---|---|---|---|---|---|
# ID | View | Status | # ID | Name | Abstraction | Structure | Status | |
CWE-1000 | Research Concepts | Draft | CWE-705 | Incorrect Control Flow Scoping | Class | Simple | Incomplete | |
CWE-1000 | Research Concepts | Draft | CWE-755 | Improper Handling of Exceptional Conditions | Class | Simple | Incomplete | |
CWE-1000 | Research Concepts | Draft | CWE-221 | Information Loss or Omission | Class | Simple | Incomplete |
Loading...