1292
CWE-570: Expression is Always False
Weakness ID : 570
Structure : Simple
Abstraction : Base
Description
The product contains an expression that will always evaluate to false.
Relationships
The table(s) below shows the weaknesses and high level categories that are related to this
weakness. These relationships are defined as ChildOf, ParentOf, MemberOr and give insight to
similar items that may exist at higher and lower levels of abstraction. In addition, relationships such
as PeerOf and CanAlsoBe are defined to show similar weaknesses that may want to be explored.
Relevant to the view "Research Concepts" (CWE-1000)
Nature Type ID Name Page
ChildOf 710 Improper Adherence to Coding Standards 1549
CanPrecede 561 Dead Code 1275
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 569 Expression Issues 2330
Applicable Platforms
Language : Not Language-Specific (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Other Quality Degradation
Varies by Context
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.)
Effectiveness = High
Potential Mitigations
Phase: Testing
Use Static Analysis tools to spot such conditions.
Demonstrative Examples
Example 1:
In the following Java example the updateUserAccountOrder() method used within an e-business
product ordering/inventory application will validate the product number that was ordered and the
user account number. If they are valid, the method will update the product inventory, the user
account, and the user order appropriately.
Example Language: Java (Bad)
public void updateUserAccountOrder(String productNumber, String accountNumber) {
CWE Version 4.14
CWE-570: Expression is Always False
CWE-570: Expression is Always False