CWE-763: Release of Invalid Pointer or Reference

Base Incomplete Simple

CWE版本: 4.18

更新日期: 2025-09-09

弱点描述

The product attempts to return a memory resource to the system, but it calls the wrong release function or calls the appropriate release function incorrectly.

常见后果

影响范围: Integrity Availability Confidentiality

技术影响: Modify Memory DoS: Crash, Exit, or Restart Execute Unauthorized Code or Commands

说明: This weakness may result in the corruption of memory, and perhaps instructions, possibly leading to a crash. If the corrupted memory can be effectively controlled, it may be possible to execute arbitrary code.

潜在缓解措施

阶段: Implementation

描述: Only call matching memory management functions. Do not mix and match routines. For example, when you allocate a buffer with malloc(), dispose of the original pointer with free().

阶段: Implementation

描述: When programming in C++, consider using smart pointers provided by the boost library to help correctly and consistently manage memory.

阶段: Architecture and Design

策略: Libraries or Frameworks

阶段: Architecture and Design

描述: Use a language that provides abstractions for memory allocation and deallocation.

阶段: Testing

描述: Use a tool that dynamically detects memory management problems, such as valgrind.

检测方法

方法: Fuzzing

Fuzz testing (fuzzing) is a powerful technique for generating large numbers of diverse inputs - either randomly or algorithmically - and dynamically invoking the code with those inputs. Even with random inputs, it is often capable of generating unexpected results such as crashes, memory corruption, or resource consumption. Fuzzing effectively produces repeatable test cases that clearly indicate bugs, which helps developers to diagnose the issues.

有效性: High

观察示例

参考: CVE-2019-11930

function "internally calls 'calloc' and returns a pointer at an index... inside the allocated buffer. This led to freeing invalid memory."

引入模式

阶段 说明
Implementation -

适用平台

编程语言
C (Often) C++ (Often)

分类映射

分类名称 条目ID 条目名称 映射适配度
Software Fault Patterns SFP12 Faulty Memory Release -
关键信息

CWE ID: CWE-763

抽象级别: Base

结构: Simple

状态: Incomplete

相关弱点