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

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CWE-476 (空指针解引用) — Vulnerability Class 1138

1138 vulnerabilities classified as CWE-476 (空指针解引用). AI Chinese analysis included.

CWE-476 represents a critical memory management weakness where software attempts to access memory through a pointer that holds a NULL value instead of a valid address. This error typically occurs when a function fails to allocate memory or validate input, yet the code proceeds to dereference the resulting null reference without checking its status. Attackers exploit this vulnerability by triggering the null condition, often causing the application to crash and resulting in a denial of service. In more complex scenarios, if the NULL pointer is manipulated to point to executable code, it may lead to arbitrary code execution or privilege escalation. To prevent this, developers must rigorously validate all pointers before use, ensuring they are not NULL. Implementing defensive programming practices, such as using assertions during development and comprehensive error handling in production, helps mitigate the risk of dereferencing invalid memory addresses.

MITRE CWE Description
The product dereferences a pointer that it expects to be valid but is NULL.
Common Consequences (2)
AvailabilityDoS: Crash, Exit, or Restart
NULL pointer dereferences usually result in the failure of the process unless exception handling (on some platforms) is available and implemented. Even when exception handling is being used, it can still be very difficult to return the software to a safe state of operation.
Integrity, ConfidentialityExecute 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.
Mitigations (5)
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].
RequirementsSelect a programming language that is not susceptible to these issues.
ImplementationCheck the results of all functions that return a value and verify that the value is non-null before acting upon it.
Effectiveness: Moderate
Architecture and DesignIdentify all variables and data stores that receive information from external sources, and apply input validation to make sure that they are only initialized to expected values.
ImplementationExplicitly initialize all variables and other data stores, either during declaration or just before the first usage.
Examples (2)
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); }
Bad · C
In the following code, the programmer assumes that the system always has a property named "cmd" defined. If an attacker can control the program's environment so that "cmd" is not defined, the program throws a NULL pointer exception when it attempts to call the trim() method.
String cmd = System.getProperty("cmd"); cmd = cmd.trim();
Bad · Java
CVE IDTitleCVSSSeverityPublished
CVE-2021-3537 libxml2 代码问题漏洞 — libxml2 5.9 -2021-05-14
CVE-2021-29513 Type confusion during tensor casts lead to dereferencing null pointers — tensorflow 2.5 Low2021-05-14
CVE-2021-29515 Reference binding to null pointer in `MatrixDiag*` ops — tensorflow 2.5 Low2021-05-14
CVE-2021-29516 Null pointer dereference via invalid Ragged Tensors — tensorflow 2.5 Low2021-05-14
CVE-2021-29518 Session operations in eager mode lead to null pointer dereferences — tensorflow 2.5 Low2021-05-14
CVE-2021-29616 Null dereference in Grappler's `TrySimplify` — tensorflow 2.5 Low2021-05-14
CVE-2021-29592 Null pointer dereference in TFLite's `Reshape` operator — tensorflow 4.4 Medium2021-05-14
CVE-2021-29564 Null pointer dereference in `EditDistance` — tensorflow 2.5 Low2021-05-14
CVE-2021-29565 Null pointer dereference in `SparseFillEmptyRows` — tensorflow 2.5 Low2021-05-14
CVE-2021-29572 Reference binding to nullptr in `SdcaOptimizer` — tensorflow 2.5 Low2021-05-14
CVE-2021-29574 Undefined behavior in `MaxPool3DGradGrad` — tensorflow 2.5 Low2021-05-14
CVE-2021-29583 Heap buffer overflow and undefined behavior in `FusedBatchNorm` — tensorflow 2.5 Low2021-05-14
CVE-2021-29530 Invalid validation in `SparseMatrixSparseCholesky` — tensorflow 2.5 Low2021-05-14
CVE-2021-29541 Null pointer dereference in `StringNGrams` — tensorflow 2.5 Low2021-05-14
CVE-2020-27830 Linux kernel 代码问题漏洞 — kernel 5.5 -2021-05-13
CVE-2021-3463 Lenovo Power Management 代码问题漏洞 — Power Management Driver for Windows 10 4.2 Medium2021-04-13
CVE-2021-28166 Eclipse Mosquitto 代码问题漏洞 — Eclipse Mosquitto 6.5 Medium2021-04-07
CVE-2021-20296 LIM OpenEXR 代码问题漏洞 — OpenEXR 7.5 -2021-04-01
CVE-2021-20213 Privoxy 代码问题漏洞 — privoxy 5.9 -2021-03-25
CVE-2021-3467 JasPer 代码问题漏洞 — jasper 5.5 -2021-03-25
CVE-2021-3443 JasPer 代码问题漏洞 — jasper 5.5 -2021-03-25
CVE-2020-17525 Remote unauthenticated denial-of-service in Subversion mod_authz_svn — Apache Subversion 7.5 -2021-03-17
CVE-2021-25674 Siemens SIMATIC 代码问题漏洞 — SIMATIC S7-PLCSIM V5.4 5.5 -2021-03-15
CVE-2021-20274 Privoxy 代码问题漏洞 — privoxy 7.5 -2021-03-09
CVE-2020-25639 Linux kernel 代码问题漏洞 — kernel 5.5 -2021-03-04
CVE-2021-26927 JasPer 代码问题漏洞 — jasper 5.5 -2021-02-23
CVE-2020-27819 Libxls 代码问题漏洞 — libxls 5.5 -2021-02-23
CVE-2020-35499 Linux kernel 代码问题漏洞 — kernel 6.7 -2021-02-19
CVE-2021-21702 Null Dereference in SoapClient — PHP 5.3 Medium2021-02-15
CVE-2021-21057 Acrobat Reader DC Invalid Memory Read Due To An Uninitialized Pointer — Acrobat Reader 6.6 Medium2021-02-11

Vulnerabilities classified as CWE-476 (空指针解引用) represent 1138 CVEs. The CWE taxonomy describes the weakness; review individual CVEs for product-specific impact.