---
title: "CWE-394: Unexpected Status Code or Return Value"
url: https://radicalnotion.ai/cwe/cwe-394
type: cwe
description: "The product does not properly check when a function or operation returns a value that is legitimate for the function, but is not expected by the product."
updated: 2026-11-10
source: RadicalNotion.AI
license: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/)
---

# CWE-394: Unexpected Status Code or Return Value

- **Abstraction:** Base
- **Structure:** Simple
- **Status:** Draft
- **CVEs with this as primary weakness:** 23
- **Of those, in CISA KEV:** 1
- **New in 2026:** 10
- **CWE catalog version:** 4.21

## Description

The product does not properly check when a function or operation returns a value that is legitimate for the function, but is not expected by the product.

## Modes of introduction

| Phase | Note |
| --- | --- |
| Implementation | - |

## Common consequences

| Scope | Impact | Note |
| --- | --- | --- |
| Integrity, Other | Unexpected State, Alter Execution Logic | - |

## 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

## Observed examples

| CVE | Description |
| --- | --- |
| CVE-2004-1395 | Certain packets (zero byte and other lengths) cause a recvfrom call to produce an unexpected return code that causes a server's listening loop to exit. |
| CVE-2002-2124 | Unchecked return code from recv() leads to infinite loop. |
| CVE-2005-2553 | Kernel function does not properly handle when a null is returned by a function call, causing it to call another function that it shouldn't. |
| CVE-2005-1858 | Memory not properly cleared when read() function call returns fewer bytes than expected. |
| CVE-2000-0536 | Bypass access restrictions when connecting from IP whose DNS reverse lookup does not return a hostname. |
| CVE-2001-0910 | Bypass access restrictions when connecting from IP whose DNS reverse lookup does not return a hostname. |
| CVE-2004-2371 | Game server doesn't check return values for functions that handle text strings and associated size values. |
| CVE-2005-1267 | Resultant infinite loop when function call returns -1 value. |

## Real CVEs with this weakness (sample of 12 of 23)

| CVE | Title | Severity | CVSS | EPSS | CISA KEV | Published |
| --- | --- | --- | --- | --- | --- | --- |
| CVE-2026-123158 | OpenBSD OpenSSH Unexpected Status Code or Return Value Vulnerability | high | 8.1 | - | Yes | 2026-11-05 |
| CVE-2025-12516 | Lack of Graceful Error Handling - HTTP 5xx Error | critical | 10.0 | - | No | 2025-10-30 |
| CVE-2025-12515 | Systemic Internal Server Errors - HTTP 500 Response | critical | 10.0 | - | No | 2025-10-30 |
| CVE-2026-25085 | Copeland XWEB and XWEB Pro Unexpected Status Code or Return Value | critical | 9.8 | - | No | 2026-02-27 |
| CVE-2026-131167 | Unsafe usage of return values | high | 8.9 | - | No | 2026-11-20 |
| CVE-2026-76956 | libexpat: libexpat: Denial of Service via hash flooding attack with crafted XML | high | 7.5 | - | No | 2026-08-20 |
| CVE-2023-25948 | Server Data type confusion - info leak | high | 7.5 | - | No | 2023-07-13 |
| CVE-2019-0066 | Junos OS: A malformed IPv4 packet received by Junos in an NG-mVPN scenario may cause the routing protocol daemon (rpd) process to core | high | 7.5 | - | No | 2019-10-09 |
| CVE-2025-23013 | pam-u2f: pam-u2f: Local privilege escalation and authentication bypass | high | 7.3 | - | No | 2025-01-15 |
| CVE-2024-1713 | Plv8 Deferred Trigger Privilege Escalation | high | 7.2 | - | No | 2024-03-14 |
| CVE-2025-48510 | - | high | 7.1 | - | No | 2025-11-24 |
| CVE-2025-22854 | Possible thread exhaustion from processing http responses in PingFederate Google Adapter | medium | 6.9 | - | No | 2025-06-15 |

## Related weaknesses

| Relationship | CWE | Name |
| --- | --- | --- |
| Parent | [CWE-754](https://radicalnotion.ai/cwe/cwe-754) | Improper Check for Unusual or Exceptional Conditions |

## Taxonomy mappings

| Taxonomy | Entry | Id | Fit |
| --- | --- | --- | --- |
| PLOVER | Unexpected Status Code or Return Value | - | - |
| Software Fault Patterns | Unchecked Status Condition | SFP4 | - |
| SEI CERT Perl Coding Standard | Do not return undef | EXP00-PL | Imprecise |

## Frequently asked questions

### What is CWE-394?

The product does not properly check when a function or operation returns a value that is legitimate for the function, but is not expected by the product.

### What CVEs are caused by CWE-394?

23 recorded CVEs are attributed to CWE-394, including CVE-2026-123158, CVE-2025-12516 and CVE-2025-12515. 1 is listed in CISA's Known Exploited Vulnerabilities (KEV) catalog.

### How is CWE-394 detected?

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.)

### What are the consequences of CWE-394?

Exploiting CWE-394 can lead to: Unexpected State, Alter Execution Logic.

### Is CWE-394 actively exploited?

Yes. 1 CWE-394 vulnerability is in CISA's KEV catalog of actively exploited flaws, out of 23 recorded CVEs.

Primary source: [MITRE CWE](https://cwe.mitre.org/data/definitions/394.html)

---

Source: [RadicalNotion.AI](https://radicalnotion.ai/cwe/cwe-394). Licensed CC BY-NC 4.0; attribute RadicalNotion.AI and link the source page when you reuse this data.
