- What is CWE-478?
- The code does not have a default case in an expression with multiple conditions, such as a switch statement.
- What CVEs are caused by CWE-478?
- 1 recorded CVEs are attributed to CWE-478, including CVE-2026-33064.
- How do you prevent CWE-478?
- Ensure that there are no cases unaccounted for when adjusting program flow or values based on the value of a given variable. In the case of switch style statements, the very simple act of creating a default case can, if done correctly, mitigate this situation. Often however, the default case is used simply to represent an assumed option, as opposed to working as a check for invalid input. This is poor practice and in some cases is as bad as omitting a default case entirely.
- How is CWE-478 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-478?
- Exploiting CWE-478 can lead to: Varies by Context, Alter Execution Logic.
- Is CWE-478 actively exploited?
- 1 recorded CVEs are caused by CWE-478; none are currently in CISA's KEV catalog of actively exploited flaws.