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-2019-3840 Red Hat libvirt 代码问题漏洞 — libvirt 6.3 -2019-03-27
CVE-2018-6343 Facebook Proxygen 安全漏洞 — Proxygen 7.5 -2018-12-31
CVE-2018-16851 Samba AD DC LDAP服务器安全漏洞 — samba 6.5 -2018-11-28
CVE-2018-16852 Samba 安全漏洞 — samba 4.4 -2018-11-28
CVE-2018-14646 Linux kernel 安全漏洞 — kernel: 5.5 -2018-11-26
CVE-2018-12469 Micro Focus Enterprise Developer and Enterprise Server 安全漏洞 — Micro Focus Enterprise Developer, Micro Focus Enterprise Server 7.5 -2018-10-12
CVE-2018-10914 Red Hat glusterfs服务器代码问题漏洞 — glusterfs 6.5 -2018-09-04
CVE-2017-2635 Red Hat Libvirt 安全漏洞 — libvirt 6.5 -2018-08-22
CVE-2018-10918 Samba 代码问题漏洞 — samba 6.5 -2018-08-22
CVE-2016-9572 OpenJPEG 安全漏洞 — openjpeg 6.5 -2018-08-01
CVE-2016-8626 Red Hat Ceph 输入验证漏洞 — Ceph 6.5 -2018-07-31
CVE-2017-2634 Linux kernel 代码问题漏洞 — kernel: 9.1 -2018-07-27
CVE-2017-2586 Netpbm 安全漏洞 — netpbm 5.5 -2018-07-27
CVE-2017-15120 PowerDNS Recursor 安全漏洞 — pdns-recursor 7.5 -2018-07-27
CVE-2018-0305 多款Cisco产品FXOS Software和NX-OS Software Fabric Services组件安全漏洞 — Cisco FXOS and NX-OS unknown 7.5 -2018-06-21
CVE-2018-1172 Squid Software Foundation Squid 安全漏洞 — The Squid Software Foundation Squid 5.9 -2018-05-16
CVE-2018-1130 Linux kernel 安全漏洞 — kernel 5.5 -2018-05-10
CVE-2018-1050 Samba 代码问题漏洞 — Samba 5.7 -2018-03-13
CVE-2016-9600 JasPer 安全漏洞 — jasper 6.5 -2018-03-12
CVE-2018-5449 Moxa OnCell G3100-HSPA Series 安全漏洞 — Moxa OnCell G3100-HSPA Series 7.5 -2018-03-05
CVE-2017-12193 Linux kernel 代码问题漏洞 — Linux kernel since 3.13 up to 4.14 (not including) 5.0 -2017-11-22
CVE-2017-12153 Linux kernel 安全漏洞 — kernel since v3.1-rc1 through v4.13 4.4 -2017-09-21
CVE-2017-9631 Schneider Electric Wonderware ArchestrA Logger 安全漏洞 — Schneider Electric Wonderware ArchestrA Logger 7.5 -2017-07-07
CVE-2017-3169 Apache httpd 安全漏洞 — Apache HTTP Server 9.1 -2017-06-20
CVE-2017-7502 NSS 代码问题漏洞 — nss 7.5 -2017-05-30
CVE-2017-7511 Poppler pdfunite 安全漏洞 — poppler 5.5 -2017-05-30
CVE-2016-6561 Oracle illumos 安全漏洞 — osnet-incorporation 7.5 -2017-03-31
CVE-2014-0757 Smart Software Solutions (3S) CoDeSys Runtime Toolkit NULL Pointer Dereference — CoDeSys Runtime Toolkit 7.5 -2014-01-31

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