CWE-395
Weakness AllowedUse of NullPointerException Catch to Detect NULL Pointer Dereference
Abstraction: Variant · Status: Draft
Catching NullPointerException should not be used as an alternative to programmatic checks to prevent dereferencing a null pointer.
Mapping guidance
This CWE entry is at the Base level of abstraction, which is a preferred level of abstraction for mapping to the root causes of vulnerabilities.
Carefully read both the name and description to ensure that this mapping is an appropriate fit. Do not try to 'force' a mapping to a lower-level Base/Variant simply to comply with this preferred level of abstraction.
Modes of introduction
Programmers typically catch NullPointerException under three circumstances:
The program contains a null pointer dereference. Catching the resulting exception was easier than fixing the underlying problem.
The program explicitly throws a NullPointerException to signal an error condition.
The code is part of a test harness that supplies unexpected input to the classes under test.
Of these three circumstances, only the last is acceptable.
Detection methods
Automated Static Analysis - Binary or Bytecode
According to SOAR [REF-1479], the following detection techniques may be useful:
Cost effective for partial coverage:
Bytecode Weakness Analysis - including disassembler + source code weakness analysis
Binary Weakness Analysis - including disassembler + source code weakness analysis
Effectiveness: SOAR Partial
Dynamic Analysis with Manual Results Interpretation
According to SOAR [REF-1479], the following detection techniques may be useful:
Cost effective for partial coverage:
Framework-based Fuzzer
Effectiveness: SOAR Partial
Manual Static Analysis - Source Code
According to SOAR [REF-1479], the following detection techniques may be useful:
Cost effective for partial coverage:
Manual Source Code Review (not inspections)
Effectiveness: SOAR Partial
Automated Static Analysis - Source Code
According to SOAR [REF-1479], the following detection techniques may be useful:
Highly cost effective:
Source code Weakness Analyzer
Context-configured Source Code Weakness Analyzer
Effectiveness: High
Architecture or Design Review
According to SOAR [REF-1479], the following detection techniques may be useful:
Highly cost effective:
Formal Methods / Correct-By-Construction
Cost effective for partial coverage:
Inspection (IEEE 1028 standard) (can apply to requirements, design, source code, etc.)
Effectiveness: High
Content history
updated Time_of_Introduction
updated Relationships, Other_Notes, Taxonomy_Mappings
updated Relationships
updated Demonstrative_Examples
updated Other_Notes, Relationships
updated Common_Consequences, Relationships, Taxonomy_Mappings
updated Relationships
updated Potential_Mitigations
updated Description, Other_Notes
updated Detection_Factors, Relationships
updated Taxonomy_Mappings
updated References
updated Relationships
updated Mapping_Notes
updated Demonstrative_Examples
updated Detection_Factors, References
updated Weakness_Ordinalities
updated Common_Consequences, Description, Modes_of_Introduction, References, Type
11 vulnerabilities reference this CWE, most recent first.
CVE-2022-2832 (GCVE-0-2022-2832)
Vulnerability from cvelistv5 – Published: 2022-08-16 19:26 – Updated: 2024-08-03 00:52| URL | Tags |
|---|---|
| https://developer.blender.org/T99706 | x_refsource_MISC |
| https://developer.blender.org/D15463 | x_refsource_MISC |
| https://developer.blender.org/rB00dc7477022acdd96… | x_refsource_MISC |
{
"containers": {
"adp": [
{
"providerMetadata": {
"dateUpdated": "2024-08-03T00:52:59.535Z",
"orgId": "af854a3a-2127-422b-91ae-364da2661108",
"shortName": "CVE"
},
"references": [
{
"tags": [
"x_refsource_MISC",
"x_transferred"
],
"url": "https://developer.blender.org/T99706"
},
{
"tags": [
"x_refsource_MISC",
"x_transferred"
],
"url": "https://developer.blender.org/D15463"
},
{
"tags": [
"x_refsource_MISC",
"x_transferred"
],
"url": "https://developer.blender.org/rB00dc7477022acdd969e4d709a235c0be819efa6c"
}
],
"title": "CVE Program Container"
}
],
"cna": {
"affected": [
{
"product": "Blender",
"vendor": "n/a",
"versions": [
{
"status": "affected",
"version": "Blender 3.3.0"
}
]
}
],
"descriptions": [
{
"lang": "en",
"value": "A flaw was found in Blender 3.3.0. A null pointer dereference exists in source/blender/gpu/opengl/gl_backend.cc that may lead to loss of confidentiality and integrity."
}
],
"problemTypes": [
{
"descriptions": [
{
"cweId": "CWE-395",
"description": "CWE-395",
"lang": "en",
"type": "CWE"
}
]
}
],
"providerMetadata": {
"dateUpdated": "2022-09-01T21:00:00.000Z",
"orgId": "53f830b8-0a3f-465b-8143-3b8a9948e749",
"shortName": "redhat"
},
"references": [
{
"tags": [
"x_refsource_MISC"
],
"url": "https://developer.blender.org/T99706"
},
{
"tags": [
"x_refsource_MISC"
],
"url": "https://developer.blender.org/D15463"
},
{
"tags": [
"x_refsource_MISC"
],
"url": "https://developer.blender.org/rB00dc7477022acdd969e4d709a235c0be819efa6c"
}
]
}
},
"cveMetadata": {
"assignerOrgId": "53f830b8-0a3f-465b-8143-3b8a9948e749",
"assignerShortName": "redhat",
"cveId": "CVE-2022-2832",
"datePublished": "2022-08-16T19:26:05.000Z",
"dateReserved": "2022-08-16T00:00:00.000Z",
"dateUpdated": "2024-08-03T00:52:59.535Z",
"state": "PUBLISHED"
},
"dataType": "CVE_RECORD",
"dataVersion": "5.1"
}
Mitigation
Do not extensively rely on catching exceptions (especially for validating user input) to handle errors. Handling exceptions can decrease the performance of an application.
No CAPEC attack patterns related to this CWE.