---
title: "CWE-396: Declaration of Catch for Generic Exception"
url: https://radicalnotion.ai/cwe/cwe-396
type: cwe
description: "Catching overly broad exceptions promotes complex error handling code that is more likely to contain security vulnerabilities."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-396: Declaration of Catch for Generic Exception

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 2
- **Of those, in CISA KEV:** 0
- **New in 2026:** 2
- **CWE catalog version:** 4.21

## Description

Catching overly broad exceptions promotes complex error handling code that is more likely to contain security vulnerabilities.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Applicable platforms

**Languages:** C++ (Undetermined), Java (Undetermined), C# (Undetermined), Python (Undetermined)

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Non-Repudiation, Other | Hide Activities | 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. A generic exception can hide details about unexpected adversary activities by making it difficult to properly troubleshoot error conditions during execution. |

## Detection methods

### 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.)

Effectiveness: High

## Demonstrative examples

### Example 1

The following code excerpt handles three types of exceptions in an identical fashion.

Good code:

```java
try {
    doExchange();
}
catch (IOException e) {
    logger.error("doExchange failed", e);
}
catch (InvocationTargetException e) {

    logger.error("doExchange failed", e);
}
catch (SQLException e) {

    logger.error("doExchange failed", e);
}
```

Bad code:

```java
try {
    doExchange();
}
catch (Exception e) {
    logger.error("doExchange failed", e);
}
```

## Real CVEs with this weakness

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-40149 | PraisonAI has an Unauthenticated Allow-List Manipulation Bypasses Agent Tool Approval Safety Controls | high | 7.9 | - | No | 2026-04-09 |
| CVE-2026-27482 | Ray: Dashboard DELETE endpoints allow unauthenticated browser-triggered DoS (Serve shutdown / job deletion) | medium | 6.5 | - | No | 2026-02-21 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-221](https://radicalnotion.ai/cwe/cwe-221) | Information Loss or Omission |
| Parent | [CWE-705](https://radicalnotion.ai/cwe/cwe-705) | Incorrect Control Flow Scoping |
| Parent | [CWE-755](https://radicalnotion.ai/cwe/cwe-755) | Improper Handling of Exceptional Conditions |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| 7 Pernicious Kingdoms | Overly-Broad Catch Block | - | - |
| Software Fault Patterns | Ambiguous Exception Type | SFP5 | - |
| OMG ASCSM | - | ASCSM-CWE-396 | - |
| OMG ASCRM | - | ASCRM-CWE-396 | - |
| OpenSSF Secure Coding Guide for Python | Propagate Exceptions and Preserve Context | pyscg-0016 | - |

## Frequently asked questions

### What is CWE-396?

Catching overly broad exceptions promotes complex error handling code that is more likely to contain security vulnerabilities.

### What CVEs are caused by CWE-396?

2 recorded CVEs are attributed to CWE-396, including CVE-2026-40149 and CVE-2026-27482.

### How is CWE-396 detected?

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.)

### What are the consequences of CWE-396?

Exploiting CWE-396 can lead to: Hide Activities.

### Is CWE-396 actively exploited?

2 recorded CVEs are caused by CWE-396; none are currently in CISA's KEV catalog of actively exploited flaws.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/396.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-396). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
