LiveActive security incident?Get immediate response
CWE Reference

CWE-395: Use of NullPointerException Catch to Detect NULL… | Glexia

CWE-395 (Use of NullPointerException Catch to Detect NULL Pointer Dereference) weakness overview with consequences, detection methods, mitigations, related CVEs…

Release 4.20weaknessDraft

Glexia's Take · Automated analysis

CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference

Use of NullPointerException Catch to Detect NULL Pointer Dereference represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.

Executive Impact

  • Availability: DoS: Resource Consumption (CPU)

Developer Pattern

CWE-395 is the kind of defect developers can usually prevent with explicit validation, safer framework defaults, and tests that exercise hostile input or unsafe state transitions.

Automation confidence

high confidence from CWE-395, 4.20.

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Official CWE Definition

CWE-395: Use of NullPointerException Catch to Detect NULL Pointer Dereference

Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.

Type
weakness
Abstraction
Base
Status
Draft
Source
MITRE CWE definition

Developer And Remediation Guidance

How teams prevent and detect this weakness

Causes

  • The following code mistakenly catches a NullPointerException.

Remediation

  • Architecture and Design,Implementation: Do not extensively rely on catching exceptions (especially for validating user input) to handle errors. Handling exceptions can decrease the performance of an application.

Detection

  • Automated Static Analysis - Binary or Bytecode:
  • Dynamic Analysis with Manual Results Interpretation:
  • Manual Static Analysis - Source Code:
  • Automated Static Analysis - Source Code:
  • Architecture or Design Review:

Mappings

Related CVEs, CWEs, and ATT&CK context

Related CWEs

Related CVEs

Related CVE mappings appear after CVE records are cross-indexed.

Open CWE CVE mapping

ATT&CK Relevance

ATT&CK relevance is shown only when reviewed or responsibly inferred.