CWE-397 · Słabość
Declaration of Throws for Generic Exception
- Abstrakcja
- Bazowa
- Status
- Szkic
- Dodano
- 19 lipca 2006
- Ostatnia zmiana
- 11 grudnia 2025
Opis
The product throws or raises an overly broad exceptions that can hide important details and produce inappropriate responses to certain conditions.
Declaring a method to throw Exception or Throwable promotes generic error handling procedures that make it difficult for callers to perform proper error handling and error recovery. For example, Java's exception mechanism makes it easy for callers to anticipate what can go wrong and write code to handle each specific exceptional circumstance. Declaring that a method throws a generic form of exception defeats this system.
Skutki
Non-Repudiation, Other
Hide Activities; Alter Execution Logic
Throwing 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++, C#, Java, Python
Uwagi
For C++, this weakness only applies to C++98, C++03, and C++11. It relies on a feature known as Dynamic Exception Specification, which was part of early versions of C++ but was deprecated in C++11. It has been removed for C++17 and later.
Źródła
- Seven Pernicious Kingdoms: A Taxonomy of Software Security Errors — Katrina Tsipenyuk, Brian Chess, Gary McGraw, NIST, 2005
- Automated Source Code Reliability Measure (ASCRM) — Object Management Group (OMG), ASCRM-CWE-397, 2016
- Automated Source Code Security Measure (ASCSM) — Object Management Group (OMG), ASCSM-CWE-397, 2016
Wpis z katalogu CWE 4.20.