CyberGlossary

Vulnerabilities

Null Pointer Dereference

Also known as: Null deref

Definition

A bug in which a program reads or writes through a pointer whose value is null (or otherwise invalid), typically causing a crash and sometimes enabling exploitation.

Null pointer dereferences (CWE-476) occur when code dereferences a pointer that was never initialised, was set to NULL after free, or whose returning function failed silently. On most modern systems this causes a segmentation fault and the process dies, which becomes a denial-of-service issue. In some constrained environments — older kernels where address zero is mappable, embedded MMU-less systems, certain JIT compilers — null dereferences can be turned into memory-corruption primitives. Defences include strict null checking, language features (Optional/Maybe types, non-nullable references), static analysis, sanitizer-based testing, and operating-system controls such as mmap_min_addr that forbid mapping low addresses.

Examples

  • A web server that crashes when an optional header is missing.
  • Historical Linux kernel null-deref bugs exploitable when mmap_min_addr was 0.

Related terms