Heap-based Buffer Overflow Affecting zlib package, versions [,1.3.2)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Heap-based Buffer Overflow vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-CONAN-ZLIB-20840300
  • published12 Oct 2026
  • disclosed18 Feb 2026
  • creditUnknown

Introduced: 18 Feb 2026

CVE NOT AVAILABLE CWE-122  (opens in a new tab)

How to fix?

Upgrade zlib to version 1.3.2 or higher.

Overview

Affected versions of this package are vulnerable to Heap-based Buffer Overflow in the gzvprintf and gzprintf functions in gzwrite.c, where the fallback path selected by the NO_vsnprintf and NO_snprintf macros formats into the internal state->in buffer with vsprintf or sprintf and performs no length enforcement against state->size. An attacker who controls the format string or the arguments passed to gzprintf can write past the end of the heap allocation and corrupt adjacent memory and chunk metadata, since the physical allocation is only state->want << 1. This requires the library to have been built in the legacy configuration that defines those macros, which is reached only on platforms without C99 snprintf.

Note: This cannot be triggered by compressed input alone. gzprintf is write-side, and nothing on the inflate path calls it.

Note: This is a bypass of the fix for the vulnerability described in CVE-2003-0107, and described as a known limitation to avoid in https://zlib.net/zlib_faq.html#faq33.

CVSS Base Scores

version 4.0
version 3.1