CWE-396 · Słabość
Declaration of Catch for Generic Exception
- Abstrakcja
- Bazowa
- Status
- Szkic
- Dodano
- 19 lipca 2006
- Ostatnia zmiana
- 11 grudnia 2025
Opis
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.
Skutki
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.
Słabość nadrzędna
Kiedy powstaje
- Implementation
Dotyczy
C++, Java, C#, Python
Źródła
- Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors — Katrina Tsipenyuk, Brian Chess, Gary McGraw, NIST, 2005
- 24 Deadly Sins of Software Security — Michael Howard, David LeBlanc, John Viega, "Sin 9: Catching Exceptions." Page 157, McGraw-Hill, 2010
- Automated Source Code Reliability Measure (ASCRM) — Object Management Group (OMG), ASCRM-CWE-396, 2016
- Automated Source Code Security Measure (ASCSM) — Object Management Group (OMG), ASCSM-CWE-396, 2016
Wpis z katalogu CWE 4.20.