Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-393 (返回错误的状态编码) — Vulnerability Class 5

5 vulnerabilities classified as CWE-393 (返回错误的状态编码). AI Chinese analysis included.

CWE-393 represents a logic error where a software component returns an inaccurate status code, misleading the calling entity about the true outcome of an operation. This weakness typically arises when developers fail to map specific error conditions to their corresponding standard codes, resulting in ambiguous or incorrect feedback. Attackers exploit this by manipulating inputs to trigger unexpected code paths, potentially bypassing security checks or causing denial of service if the system misinterprets a failure as success. To mitigate this risk, developers must rigorously validate return values and ensure strict adherence to established error-handling protocols. Implementing comprehensive unit tests that verify every possible exit path and status code combination is essential. Additionally, using static analysis tools can help identify discrepancies between expected and actual return values, ensuring that security-critical decisions rely on accurate execution results.

MITRE CWE Description
A function or operation returns an incorrect return value or status code that does not indicate the true result of execution, causing the product to modify its behavior based on the incorrect result. 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 or correct, even when it is not.
Common Consequences (1)
Integrity, OtherUnexpected 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.
Examples (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.
try { // something that might throw IOException ... } catch (IOException ioe) { response.sendError(SC_NOT_FOUND); }
Bad · Java

Vulnerabilities classified as CWE-393 (返回错误的状态编码) represent 5 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.