CWE-393: Return of Wrong Status Code

Base Draft Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

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.

常见后果

影响范围: 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.

检测方法

方法: 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.

有效性: High

观察示例

参考: CVE-2003-1132

DNS server returns wrong response code for non-existent AAAA record, which effectively says that the domain is inaccessible.

参考: CVE-2001-1509

Hardware-specific implementation of system call causes incorrect results from geteuid.

参考: CVE-2001-1559

Chain: System call returns wrong value (CWE-393), leading to a resultant NULL dereference (CWE-476).

参考: CVE-2014-1266

chain: incorrect "goto" in Apple SSL product bypasses certificate validation, allowing Adversary-in-the-Middle (AITM) attack (Apple "goto fail" bug). CWE-705 (Incorrect Control Flow Scoping) -> CWE-561 (Dead Code) -> CWE-295 (Improper Certificate Validation) -> CWE-393 (Return of Wrong Status Code) -> CWE-300 (Channel Accessible by Non-Endpoint).

引入模式

阶段 说明
Implementation -

适用平台

编程语言
Not Language-Specific (Undetermined)

分类映射

分类名称 条目ID 条目名称 映射适配度
PLOVER - Wrong Status Code -
Software Fault Patterns SFP6 Incorrect Exception Behavior -
关键信息

CWE ID: CWE-393

抽象级别: Base

结构: Simple

状态: Draft

相关弱点