The product does not check for an error after calling a function that can return with a NULL pointer if the function fails, which leads to a resultant NULL pointer dereference.
While unchecked return value weaknesses are not limited to returns of NULL pointers (see the examples in CWE-252), functions often return NULL to indicate an error status. When this error condition is not checked, a NULL pointer dereference can occur.

Primary

Implementation
A typical occurrence of this weakness occurs when an application includes user-controlled input to a malloc() call. The related code might be correct with respect to preventing buffer overflows, but if a large value is provided, the malloc() will fail due to insufficient memory. This problem also frequently occurs when a parsing routine expects that certain elements will always be present. If malformed input is provided, the parser might return NULL. For example, strtok() can return NULL.

Availability
DoS: Crash, Exit, or Restart

Integrity
Confidentiality
Availability
Execute Unauthorized Code or Commands
Read Memory
Modify Memory
In rare circumstances, when NULL is equivalent to the 0x0 memory address and privileged code can access it, then writing or reading memory is possible, which may lead to code execution.

Black Box
This typically occurs in rarely-triggered error conditions, reducing the chances of detection during black box testing.

White Box
Code analysis can require knowledge of API behaviors for library functions that might return NULL, reducing the chances of detection when unknown libraries are used.

Automated Dynamic Analysis
Use tools that are integrated during
compilation to insert runtime error-checking mechanisms
related to memory safety errors, such as AddressSanitizer
(ASan) for C/C++ [REF-1518].
Moderate
Crafted inputs are necessary to
reach the code containing the error, such as generated
by fuzzers. Also, these tools may reduce performance,
and they only report the error condition - not the
original mistake that led to the
error.

The code below makes a call to the getUserName() function but doesn't check the return value before dereferencing (which may cause a NullPointerException).

String username = getUserName();if (username.equals(ADMIN_USER)) {...}

This example takes an IP address from a user, verifies that it is well formed and then looks up the hostname and copies it into a buffer.

void host_lookup(char *user_supplied_addr){
struct hostent *hp;in_addr_t *addr;char hostname[64];in_addr_t inet_addr(const char *cp);

/*routine that ensures user_supplied_addr is in the right format for conversion */

validate_addr_form(user_supplied_addr);addr = inet_addr(user_supplied_addr);hp = gethostbyaddr( addr, sizeof(struct in_addr), AF_INET);strcpy(hostname, hp->h_name);
}

If an attacker provides an address that appears to be well-formed, but the address does not resolve to a hostname, then the call to gethostbyaddr() will return NULL. Since the code does not check the return value from gethostbyaddr (CWE-252), a NULL pointer dereference (CWE-476) would then occur in the call to strcpy().
Note that this code is also vulnerable to a buffer overflow (CWE-119).

CVE-2008-1052
Large Content-Length value leads to NULL pointer dereference when malloc fails.
https://www.cve.org/CVERecord?id=CVE-2008-1052

CVE-2006-6227
Large message length field leads to NULL pointer dereference when malloc fails.
https://www.cve.org/CVERecord?id=CVE-2006-6227

CVE-2006-2555
Parsing routine encounters NULL dereference when input is missing a colon separator.
https://www.cve.org/CVERecord?id=CVE-2006-2555

CVE-2003-1054
URI parsing API sets argument to NULL when a parsing failure occurs, such as when the Referer header is missing a hostname, leading to NULL dereference.
https://www.cve.org/CVERecord?id=CVE-2003-1054

CVE-2008-5183
chain: unchecked return value can lead to NULL dereference
https://www.cve.org/CVERecord?id=CVE-2008-5183

EXP34-C
Do not dereference null pointers
CWE More Specific

ERR08-J
Do not catch NullPointerException or any of its ancestors

EXP32-PL
Do not ignore function return values
CWE More Specific

Discouraged
This CWE entry is a named chain, which combines multiple weaknesses.
Mapping to each separate weakness in the chain would be more precise.

CWE Content Team
MITRE
2008-04-11
Draft 9
2008-04-11

Sean Eidemiller
Cigital
2008-07-01
added/updated demonstrative examples

Eric Dalci
Cigital
2008-07-01
updated Time_of_Introduction

CWE Content Team
MITRE
2008-09-08
updated Applicable_Platforms, Description, Detection_Factors, Relationships, Other_Notes

CWE Content Team
MITRE
2009-12-28
updated Demonstrative_Examples

CWE Content Team
MITRE
2010-09-27
updated Observed_Examples

CWE Content Team
MITRE
2011-06-01
updated Common_Consequences, Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2011-09-13
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2014-06-23
updated Modes_of_Introduction, Other_Notes

CWE Content Team
MITRE
2017-01-19
updated Relationships

CWE Content Team
MITRE
2017-11-08
updated Relationships, Relevant_Properties, Taxonomy_Mappings, Time_of_Introduction

CWE Content Team
MITRE
2019-01-03
updated Relationships, Taxonomy_Mappings

CWE Content Team
MITRE
2020-06-25
updated Common_Consequences

CWE Content Team
MITRE
2021-03-15
updated Demonstrative_Examples, Relationships

CWE Content Team
MITRE
2023-04-27
updated Relationships

CWE Content Team
MITRE
2023-06-29
updated Mapping_Notes, Relationships

CWE Content Team
MITRE
2025-12-11
4.19
2025-12-11
updated Applicable_Platforms, Detection_Factors, References, Weakness_Ordinalities