CWEweakness
CWE-783 Operator Precedence Logic Error
Low
Official page ↗
- Abstraction
- Base
- Structure
- Simple
- Status
- Draft
- Likelihood of exploit
- Low
- Languages
- C, C++, Not Language-Specific, Python
- CWE version
- 5.0
Description
The product uses an expression in which operator precedence causes incorrect logic to be used.
Common consequences
• Confidentiality, Integrity, Availability: Varies by Context, Unexpected State — While often just a bug, operator precedence logic errors can have serious consequences if they are used in security-critical code, such as making an authentication decision. The consequences will vary based on the context surrounding the incorrect precedence. In a security decision, violations of integrity or confidentiality are the most likely results. Otherwise, a crash may occur due to the software reaching an unexpected state.
Potential mitigations
• [Implementation] Regularly wrap sub-expressions in parentheses, especially in security-critical code.
Detection methods
• 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.)
Observed examples
• CVE-2026-7270: Chain: calculation expression does not use parentheses to address operator precedence (CWE-783), causing an incorrect calculation (CWE-682) leading to a buffer overflow (CWE-787).
• CVE-2008-2516: Authentication module allows authentication bypass because it uses "(x = call(args) == SUCCESS)" instead of "((x = call(args)) == SUCCESS)".
• CVE-2008-0599: Chain: Language interpreter calculates wrong buffer size (CWE-131) by using "size = ptr ? X : Y" instead of "size = (ptr ? X : Y)" expression.
• CVE-2001-1155: Chain: product does not properly check the result of a reverse DNS lookup because of operator precedence (CWE-783), allowing bypass of DNS-based access restrictions.
Related
Observed example · CVE (4)
- CVE-2026-7270 An operator precedence bug in the kernel results in a scenario where a buffer overflow causes attacker-controlled data to overwrite… vulnerability
- CVE-2008-2516 pam_sm_authenticate in pam_pgsql.c in libpam-pgsql 0.6.3 does not properly consider operator precedence when evaluating the success of a… vulnerability
- CVE-2008-0599 The init_request_info function in sapi/cgi/cgi_main.c in PHP before 5.2.6 does not properly consider operator precedence when calculating… vulnerability
- CVE-2001-1155 TCP Wrappers (tcp_wrappers) in FreeBSD 4.1.1 through 4.3 with the PARANOID ACL option enabled does not properly check the result of a… vulnerability
Child of · CWE (1)
- CWE-670 Always-Incorrect Control Flow Implementation weakness
Referenced by CVE · weakness (22)
- CVE-2026-108690 mall4j through 4.0 contains an information disclosure vulnerability that allows authenticated customers to read other shoppers' cart items… vulnerability
- CVE-2026-108691 mall4j through 4.0 contains an improper authorization vulnerability that allows authenticated storefront customers to delete other… vulnerability
- CVE-2026-7270 An operator precedence bug in the kernel results in a scenario where a buffer overflow causes attacker-controlled data to overwrite… vulnerability
- CVE-2026-0209 Under certain administrative conditions, FlashArray Purity may apply snapshot retention policies earlier or later than configured. vulnerability
- CVE-2026-25233 PEAR is a framework and distribution system for reusable PHP components. vulnerability
- CVE-2025-24210 A logic error was addressed with improved error handling. vulnerability
- CVE-2025-27512 Zincati is an auto-update agent for Fedora CoreOS hosts. vulnerability
- CVE-2024-49736 In onClick of MainClear.java, there is a possible way to trigger factory reset without explicit user consent due to a logic error in the… vulnerability
- CVE-2017-13322 In endCallForSubscriber of PhoneInterfaceManager.java, there is a possible way to prevent access to emergency services due to a logic error… vulnerability
- CVE-2024-20480 A vulnerability in the DHCP Snooping feature of Cisco IOS XE Software on Software-Defined Access (SD-Access) fabric edge nodes could allow… vulnerability
- CVE-2024-44093 In ppmp_unprotect_buf of drm/code/drm_fw.c, there is a possible memory corruption due to a logic error in the code. vulnerability
- CVE-2024-34741 In setForceHideNonSystemOverlayWindowIfNeeded of WindowState.java, there is a possible way for message content to be visible on the… vulnerability
- CVE-2024-27886 A logic issue was addressed with improved restrictions. vulnerability
- CVE-2024-31326 In multiple locations, there is a possible way in which policy migration code will never be executed due to a logic error in the code. vulnerability
- CVE-2024-31331 In setMimeGroup of PackageManagerService.java, there is a possible way to hide the service from Settings due to a logic error in the code. vulnerability
- CVE-2024-31335 In DevmemIntChangeSparse2 of devicemem_server.c, there is a possible arbitrary code execution due to a logic error in the code. vulnerability
- CVE-2024-34720 In com_android_internal_os_ZygoteCommandBuffer_nativeForkRepeatedly of com_android_internal_os_ZygoteCommandBuffer.cpp, there is a possible… vulnerability
- CVE-2024-34723 In onTransact of ParcelableListBinder.java , there is a possible way to steal mAllowlistToken to launch an app from background due to a… vulnerability
- CVE-2024-34726 In PVRSRV_MMap of pvr_bridge_k.c, there is a possible arbitrary code execution due to a logic error in the code. vulnerability
- CVE-2024-32896 there is a possible way to bypass due to a logic error in the code. vulnerability
- CVE-2024-20314 A vulnerability in the IPv4 Software-Defined Access (SD-Access) fabric edge node feature of Cisco IOS XE Software could allow an… vulnerability
- CVE-2022-20477 In shouldHideNotification of KeyguardNotificationVisibilityProvider.kt, there is a possible way to show hidden notifications due to a logic… vulnerability
Referenced by CWE · has member (1)
- CWE-884 CWE Cross-section view