Skip to main content

CWE-484: Omitted Break Statement in Switch

BaseDraftExploit Likelihood: Medium

The product omits a break statement within a switch or similar construct, causing code associated with multiple conditions to execute. This can cause problems when the programmer only intended to execute code associated with one condition.

View on MITRE
Back to CWE Lookup

Extended Description

This can lead to critical code executing in situations where it should not.

Technical Details

Structure
Simple

Applicable To

Languages
CC++JavaC#PHP
Platforms

Frequently Asked Questions

What is CWE-484: Omitted Break Statement in Switch?+

CWE-484: Omitted Break Statement in Switch is a Common Weakness Enumeration (CWE) entry maintained by MITRE. The product omits a break statement within a switch or similar construct, causing code associated with multiple conditions to execute. This can cause problems when the programmer only intended to execute code associated with one condition. This can lead to critical code executing in situations where it should not.

What are the security consequences of Omitted Break Statement in Switch?+

If exploited, CWE-484 (Omitted Break Statement in Switch) it can compromise Other, leading to outcomes such as Alter Execution Logic.

How do you prevent or mitigate Omitted Break Statement in Switch?+

Recommended mitigations for CWE-484 include: Omitting a break statement so that one may fall through is often indistinguishable from an error, and therefore should be avoided. If you need to use fall-through capabilities, make sure that you have clearly documented this within the switch statement, and ensure that you have examined all the logical possibilities. The functionality of omitting a break statement could be clarified with an if statement. This method is much safer.

How is Omitted Break Statement in Switch detected?+

CWE-484 can be detected using White Box and Black Box. Combining automated tooling with manual review typically yields the best coverage.

Which programming languages are affected by Omitted Break Statement in Switch?+

CWE-484 commonly affects C, C++, Java, C# and PHP. Note that weaknesses are often language-agnostic patterns, so secure coding practices apply broadly.

What is the difference between a CWE and a CVE?+

A CWE (Common Weakness Enumeration) like CWE-484 describes a category of software weakness — the underlying flaw type. A CVE (Common Vulnerabilities and Exposures) identifies a specific, real-world vulnerability in a particular product. In short, a CWE is the kind of mistake, and a CVE is an instance of that mistake being found in software.

Learn More