CWE•Base•Draft•15 recent CVEs
CWE-252Unchecked Return Value
Description
The product does not check the return value from a method or function, which can prevent it from detecting unexpected states and conditions.
Two common programmer assumptions are "this function call can never fail" and "it doesn't matter if this function call fails". If an attacker can force the function to fail or otherwise return a value that is not expected, then the subsequent program logic could lead to a vulnerability, because the product is not in a state that the programmer assumes. For example, if the program calls a function to drop privileges but does not check the return code to ensure that privileges were successfully dropped, then the program will continue to operate with the higher privileges.
Common consequences
- Availability,Integrity→Unexpected State,DoS: Crash, Exit, or RestartAn unexpected return value could place the system in a state that could lead to a crash or other unintended behaviors.
Potential mitigations
- ImplementationCheck the results of all functions that return a value and verify that the value is expected.
- ImplementationFor any pointers that could have been modified or provided from a function that can return NULL, check the pointer for NULL before use. When working with a multithreaded or otherwise asynchronous environment, ensure that proper locking APIs are used to lock before the check, and unlock when it has finished [REF-1484].
- ImplementationEnsure that you account for all possible return values from the function.
- ImplementationWhen designing a function, make sure you return a value or throw an exception in case of an error.
Related CWEs
Recent CVEs classified under this CWE
CVE-2026-400927.52026-05-20CVE-2025-299382026-05-15CVE-2025-00282026-05-15CVE-2026-400607.52026-05-13CVE-2026-207933.32026-05-12CVE-2026-340657.52026-04-22CVE-2026-353443.32026-04-22CVE-2026-354685.32026-04-03CVE-2025-118393.32025-10-16CVE-2025-220265.52025-04-16CVE-2017-69647.82017-03-28CVE-2016-100616.52017-03-03CVE-2016-100606.52017-03-02CVE-2007-51912007-10-04CVE-2007-37989.82007-07-16