CWE Database
/

CWE-783

Back to CWE list

CWE-783

Operator Precedence Logic Error

Base
Draft

Description

The product uses an expression in which operator precedence causes incorrect logic to be used.

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.

Common Consequences

Scope

Confidentiality
Integrity
Availability

Impact

Varies by Context, Unexpected State

Potential Mitigations

Implementation

Regularly wrap sub-expressions in parentheses, especially in security-critical code.

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.

Applicable Platforms

C
C++
Not Language-Specific

Security Training

Train your team to recognize and prevent security threats with our comprehensive security awareness program.

Start Training

Vulnerability Scanning

Discover vulnerabilities in your applications and infrastructure before attackers do.

Scan Now