Katalog CWE

CWE-783 · Słabość

Operator Precedence Logic Error

Abstrakcja
Bazowa
Status
Szkic
Ryzyko wykorzystania
niskie
Dodano
16 lipca 2009
Ostatnia zmiana
11 grudnia 2025

Podatności CVE z tą słabościąPełny wpis na cwe.mitre.org ↗

Opis

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.

Skutki

  • Confidentiality, Integrity, Availability

    Varies by Context; Unexpected State

    The consequences will vary based on the context surrounding the incorrect precedence. In a security decision, integrity or confidentiality are the most likely results. Otherwise, a crash may occur due to the software reaching an unexpected state.

Zapobieganie

  • Implementation

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

Przykłady podatności

Słabość nadrzędna

Kiedy powstaje

Dotyczy

C, C++, Not Language-Specific

Źródła

  1. EXP00-C. Use parentheses for precedence of operation — CERT
  2. The Art of Software Security Assessment — Mark Dowd, John McDonald, Justin Schuh, Chapter 6, "Precedence", Page 287, Addison Wesley, 2006

Wpis z katalogu CWE 4.20.