1. CVE archive
  2. 2002
  3. CVE-2002-0059

CVE-2002-0059

9.8 Critical severity CVSS v3.1 · source NVD CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H 9.8 – Critical

Description

The decompression algorithm in zlib 1.1.3 and earlier, as used in many different utilities and packages, causes inflateEnd to release certain memory more than once (a "double free"), which may allow local and remote attackers to execute arbitrary code via a block of malformed compression data.

Affected products

VendorProductVersionPlatform
zlib zlib <= 1.1.3 –
All 15 Zlib vulnerabilities

Vulnerability type

CWE-415 Double Free

The product calls free() twice on the same memory address.

Impact on systems

ScopeImpact
Integrity, Confidentiality, Availability Modify Memory, Execute Unauthorized Code or Commands
When a program calls free() twice with the same argument, the program's memory management data structures may become corrupted, potentially leading to the reading or modification of unexpected memory addresses. This corruption can cause the program to crash or, in some circumstances, cause two later calls to malloc() to return the same pointer. If malloc() returns the same value twice and the program later gives the attacker control over the data that is written into this doubly-allocated memory, the program becomes vulnerable to a buffer overflow attack. Doubly freeing memory may result in a write-what-where condition, allowing an attacker to execute arbitrary code.

How to prevent it

Architecture and Design Choose a language that provides automatic memory management.
Implementation Ensure that each allocation is freed only once. After freeing a chunk, set the pointer to NULL to ensure the pointer cannot be freed again. In complicated error conditions, be sure that clean-up routines respect the state of allocation properly. If the language is object oriented, ensure that object destructors delete each chunk of memory only once.
Implementation Use a static analysis tool to find double free instances.

All 968 CWE-415 CVEs, with trend and prevention

Source: MITRE CWE catalog · cwe.mitre.org