Base · Medium

CWE-617: Reachable Assertion

The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.

CWE-617 · Base Level ·8 CVEs ·2 Mitigations

Description

The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.

While assertion is good for catching logic errors and reducing the chances of reaching more serious vulnerability conditions, it can still lead to a denial of service. For example, if a server handles multiple simultaneous connections, and an assert() occurs in one single connection that causes all other connections to be dropped, this is a reachable assertion that leads to a denial of service.

Potential Impact

Availability

DoS: Crash, Exit, or Restart

Demonstrative Examples

In the excerpt below, an AssertionError (an unchecked exception) is thrown if the user hasn't entered an email address in an HTML form.
Bad
String email = request.getParameter("email_address");assert email != null;

Mitigations & Prevention

Implementation

Make sensitive open/close operation non reachable by directly user-controlled data (e.g. open/close resources)

Implementation

Perform input validation on user data.

Detection Methods

  • Automated Static Analysis High — 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 sea

Real-World CVE Examples

CVE IDDescription
CVE-2024-8768API server for LLM library can crash when provided an empty prompt, which triggers a reachable assertion
CVE-2023-49286Chain: function in web caching proxy does not correctly check a return value (CWE-253) leading to a reachable assertion (CWE-617)
CVE-2006-6767FTP server allows remote attackers to cause a denial of service (daemon abort) via crafted commands which trigger an assertion failure.
CVE-2006-6811Chat client allows remote attackers to cause a denial of service (crash) via a long message string when connecting to a server, which causes an assertion failure.
CVE-2006-5779Product allows remote attackers to cause a denial of service (daemon crash) via LDAP BIND requests with long authcid names, which triggers an assertion failure.
CVE-2006-4095Product allows remote attackers to cause a denial of service (crash) via certain queries, which cause an assertion failure.
CVE-2006-4574Chain: security monitoring product has an off-by-one error that leads to unexpected length values, triggering an assertion.
CVE-2004-0270Anti-virus product has assert error when line length is non-numeric.

Taxonomy Mappings

  • The CERT Oracle Secure Coding Standard for Java (2011): MET01-J — Never use assertions to validate method arguments
  • Software Fault Patterns: SFP3 — Use of an improper API

Frequently Asked Questions

What is CWE-617?

CWE-617 (Reachable Assertion) is a software weakness identified by MITRE's Common Weakness Enumeration. It is classified as a Base-level weakness. The product contains an assert() or similar statement that can be triggered by an attacker, which leads to an application exit or other behavior that is more severe than necessary.

How can CWE-617 be exploited?

Attackers can exploit CWE-617 (Reachable Assertion) to dos: crash, exit, or restart. This weakness is typically introduced during the Implementation phase of software development.

How do I prevent CWE-617?

Key mitigations include: Make sensitive open/close operation non reachable by directly user-controlled data (e.g. open/close resources)

What is the severity of CWE-617?

CWE-617 is classified as a Base-level weakness (Medium abstraction). It has been observed in 8 real-world CVEs.