취약점 도입 방식
Implementation : This weakness often occurs when the memory is allocated explicitly on the heap with one of the malloc() family functions and free() is called, but pointer arithmetic has caused the pointer to be in the interior or end of the buffer.
적용 가능한 플랫폼
언어
클래스: Memory-Unsafe (Often)
이름: C (Undetermined)
일반적인 결과
| 범위 |
영향 |
가능성 |
Integrity Availability Confidentiality | Modify Memory, DoS: Crash, Exit, or Restart, Execute Unauthorized Code or Commands
참고: This can cause the product to crash, or in some cases, modify critical program variables or execute code. | |
관찰된 예시
| 참고 자료 |
설명 |
| function "internally calls 'calloc' and returns a pointer at an index... inside the allocated buffer. This led to freeing invalid memory." |
잠재적 완화 방법
Phases : Implementation
When utilizing pointer arithmetic to traverse a buffer, use a separate variable to track progress through memory and preserve the originally allocated address for later freeing.
Phases : Implementation
When programming in C++, consider using smart pointers provided by the boost library to help correctly and consistently manage memory.
Phases : Architecture and Design
Phases : Architecture and Design
Use a language that provides abstractions for memory allocation and deallocation.
탐지 방법
Automated Dynamic Analysis
Use tools that are integrated during
compilation to insert runtime error-checking mechanisms
related to memory safety errors, such as AddressSanitizer
(ASan) for C/C++ [REF-1518] or valgrind [REF-480].
효과성 : Moderate
취약점 매핑 메모
근거 : This CWE entry is at the Variant 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.
메모
Currently, CWE-763 is the parent, however it may be desirable to have an intermediate parent which is not function-specific, similar to how CWE-762 is an intermediate parent between CWE-763 and CWE-590.
참고 자료
REF-657
boost C++ Library Smart Pointers
https://www.boost.org/doc/libs/1_38_0/libs/smart_ptr/smart_ptr.htm REF-480
Valgrind
https://valgrind.org/ REF-1518
AddressSanitizer
https://clang.llvm.org/docs/AddressSanitizer.html
제출
| 이름 |
조직 |
날짜 |
출시일 |
Version |
| CWE Content Team |
MITRE |
2009-05-08 +00:00 |
2009-05-27 +00:00 |
1.4 |
수정 사항
| 이름 |
조직 |
날짜 |
댓글 |
| CWE Content Team |
MITRE |
2010-09-27 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2011-06-01 +00:00 |
updated Common_Consequences |
| CWE Content Team |
MITRE |
2012-05-11 +00:00 |
updated Demonstrative_Examples, Relationships |
| CWE Content Team |
MITRE |
2012-10-30 +00:00 |
updated Potential_Mitigations |
| CWE Content Team |
MITRE |
2014-02-18 +00:00 |
updated Potential_Mitigations |
| CWE Content Team |
MITRE |
2014-07-30 +00:00 |
updated Relationships, Taxonomy_Mappings |
| CWE Content Team |
MITRE |
2020-02-24 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2020-12-10 +00:00 |
updated Relationships |
| CWE Content Team |
MITRE |
2021-03-15 +00:00 |
updated Observed_Examples |
| CWE Content Team |
MITRE |
2023-01-31 +00:00 |
updated Description |
| CWE Content Team |
MITRE |
2023-04-27 +00:00 |
updated References, Relationships |
| CWE Content Team |
MITRE |
2023-06-29 +00:00 |
updated Mapping_Notes |
| CWE Content Team |
MITRE |
2025-09-09 +00:00 |
updated Functional_Areas, References |
| CWE Content Team |
MITRE |
2025-12-11 +00:00 |
updated Applicable_Platforms, Detection_Factors, Potential_Mitigations, References, Weakness_Ordinalities |
| CWE Content Team |
MITRE |
2026-04-30 +00:00 |
updated Detection_Factors |
| CWE Content Team |
MITRE |
2026-10-28 +00:00 |
updated Common_Consequences, Demonstrative_Examples, Description, Modes_of_Introduction |