1295
CWE-571: Expression is Always True
Weakness ID : 571
Structure : Simple
Abstraction : Base
Description
The product contains an expression that will always evaluate to true.
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 updateInventory() method used within an e-business product
ordering/inventory application will check if the input product number is in the store or in the
warehouse. If the product is found, the method will update the store or warehouse database as
well as the aggregate product database. If the product is not found, the method intends to do some
special processing without updating any database.
CWE Version 4.14
CWE-572: Call to Thread run() instead of start()
CWE-572: Call to Thread run() instead of start()