954
Extended Description
This can lead to unpredictable behavior. If the function is used to make security-critical decisions or
provide security-critical information, then the wrong status code can cause the product to assume
that an action is safe, even when it is not.
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 703 Improper Check or Handling of Exceptional Conditions 1535
ChildOf 684 Incorrect Provision of Specified Functionality 1505
Relevant to the view "Software Development" (CWE-699)
Nature Type ID Name Page
MemberOf 389 Error Conditions, Return Values, Status Codes 2322
Applicable Platforms
Language : Not Language-Specific (Prevalence = Undetermined)
Common Consequences
Scope Impact Likelihood
Integrity
Other
Unexpected State
Alter Execution Logic
This weakness could place the system in a state that could
lead unexpected logic to be executed or other unintended
behaviors.
Detection Methods
Fuzzing
Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs
- either randomly or algorithmically - and dynamically invoking the code with those inputs.
Even with random inputs, it is often capable of generating unexpected results such as crashes,
memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases
that clearly indicate bugs, which helps developers to diagnose the issues.
Effectiveness = High
Demonstrative Examples
Example 1:
In the following example, an HTTP 404 status code is returned in the event of an IOException
encountered in a Java servlet. A 404 code is typically meant to indicate a non-existent resource
and would be somewhat misleading in this case.
Example Language: Java (Bad)
try {
// something that might throw IOException
...
} catch (IOException ioe) {
response.sendError(SC_NOT_FOUND);
}
CWE Version 4.14
CWE-394: Unexpected Status Code or Return Value
CWE-394: Unexpected Status Code or Return Value