BaseDraft

CWE-396Declaration of Catch for Generic Exception

Category: other

Description

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.

Common consequences· 1

  • Non-Repudiation / Other — Hide Activities
    A generic exception can hide details about unexpected adversary activities by making it difficult to properly troubleshoot error conditions during execution.

References

  1. https://cwe.mitre.org/data/definitions/396.html

Related by meaning· 6

Nearest entities by semantic similarity across the cs-graph corpus.

CWE
Declaration of Throws for Generic Exception
CWE
Uncaught Exception
CWE
Use of NullPointerException Catch to Detect NULL Pointer Dereference
CWE
Missing Handler
CWE
Return Inside Finally Block
CWE
Empty Exception Block
Sourced from MITRE CWE 4.20. Curated for EU compliance use cases by Adam Lundqvist, Founder at SQUR.