Skip to main content
Vulnerability Database/CVE-2026-92842

CVE-2026-92842: PHP Stream Filter Buffer Overflow Vulnerability

CVE-2026-92842 is a buffer overflow flaw in PHP stream filters affecting convert.base64-encode and quoted-printable filters. Attackers can exploit heap memory to leak data. This post covers technical details, affected versions, impact analysis, and mitigation strategies.

Published:

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

CVE-2026-92842 Overview

CVE-2026-92842 is a heap-based buffer over-read [CWE-122] in PHP's convert.base64-encode, convert.quoted-printable-encode, and convert.quoted-printable-decode stream filters. The filters accept a line-break-chars option whose length is tracked independently of the string content. The constructors duplicate the supplied value with pestrdup(), which terminates copying at the first NUL byte while preserving the original length value. When the filter later emits a line break, it reads the recorded length from the truncated allocation, exposing adjacent heap bytes in the filter output.

Critical Impact

Attackers who can supply a crafted line-break-chars option to an affected stream filter can leak adjacent heap memory into application output, exposing sensitive process data.

Affected Products

  • PHP (php-src) — convert.base64-encode stream filter
  • PHP (php-src) — convert.quoted-printable-encode stream filter
  • PHP (php-src) — convert.quoted-printable-decode stream filter

Discovery Timeline

  • 2026-09-25 - CVE-2026-92842 published to NVD
  • 2026-09-29 - Last updated in NVD database

Technical Details for CVE-2026-92842

Vulnerability Analysis

The flaw resides in the constructor logic for the three affected convert.* stream filters in PHP. Each filter accepts an optional line-break-chars parameter that defines the byte sequence used for line termination in encoded output. The constructor records the caller-supplied length in a separate field, then duplicates the string buffer using pestrdup().

pestrdup() is a NUL-terminated string duplication primitive. When the input contains an embedded NUL byte, the duplicated allocation is shorter than the length value retained in the filter state. The mismatch between the tracked length and the actual allocation size creates an out-of-bounds read condition on every line-break emission.

During encoding, the filter copies line_break_chars_len bytes from the duplicated buffer into the output stream. Bytes past the end of the undersized allocation are read from adjacent heap memory and placed directly into attacker-visible output.

Root Cause

The root cause is an inconsistency between a length counter and the allocation it describes. The length originates from the caller-supplied option and is not recomputed after duplication. pestrdup() stops at the first NUL, producing a buffer whose true size can be smaller than the recorded length. No bounds check reconciles the two before the copy.

Attack Vector

Exploitation requires the attacker to influence the line-break-chars filter option on an affected convert.* stream filter. The filter must then process enough data to trigger line-break emission. The high attack complexity reflects the need for the application to expose filter output back to the attacker in order to retrieve the leaked heap bytes. Successful exploitation discloses adjacent heap contents, which may include fragments of other allocations handled by the PHP process.

See the GitHub Security Advisory GHSA-88hq-2827-7pg6 for upstream technical details.

Detection Methods for CVE-2026-92842

Indicators of Compromise

  • Application output from encoded streams containing non-printable or non-ASCII bytes where line breaks are expected.
  • PHP processes invoking stream_filter_append or stream_filter_prepend with convert.base64-encode, convert.quoted-printable-encode, or convert.quoted-printable-decode and a user-controlled line-break-chars parameter.
  • Unexpected content in email headers, MIME boundaries, or encoded responses produced by PHP applications.

Detection Strategies

  • Audit PHP source for calls to stream_filter_append/stream_filter_prepend that reference the three affected filters and inspect how line-break-chars is populated.
  • Scan request logs for parameters that reach filter configuration and contain embedded NUL (%00) bytes.
  • Compare installed PHP build hashes against the fixed releases referenced in the upstream advisory.

Monitoring Recommendations

  • Alert on PHP error log entries or Valgrind/AddressSanitizer reports showing invalid reads inside convert_filter or related stream filter code paths.
  • Monitor outbound responses from PHP applications for anomalous byte patterns in base64 or quoted-printable encoded fields.
  • Track package manager events for PHP upgrade activity to confirm patched builds are deployed across all hosts.

How to Mitigate CVE-2026-92842

Immediate Actions Required

  • Upgrade PHP to the patched release identified in the GitHub Security Advisory GHSA-88hq-2827-7pg6.
  • Inventory applications that register convert.base64-encode, convert.quoted-printable-encode, or convert.quoted-printable-decode filters with caller-controlled options.
  • Remove or hardcode the line-break-chars parameter so untrusted input cannot reach the filter constructor.

Patch Information

The PHP project has published a fix through GitHub Security Advisory GHSA-88hq-2827-7pg6. Apply the upstream patch or upgrade to a PHP release that incorporates the fix. Rebuild and redeploy any statically linked PHP extensions after upgrading.

Workarounds

  • Reject or sanitize any user input destined for the line-break-chars filter option, stripping NUL bytes before use.
  • Replace runtime use of the affected stream filters with alternative encoders such as base64_encode() or quoted_printable_encode() where line-break control is not required from untrusted input.
  • Enforce strict input validation at the application boundary to prevent attacker-controlled bytes from reaching stream filter constructors.
bash
# Verify installed PHP version against the fixed release
php -v

# Example: strip NUL bytes before configuring a stream filter
# php -r 'echo str_replace("\0", "", $input);'

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

Sources: National Vulnerability Database, CISA KEV, Exploit-DB

Experience the Most Advanced Cybersecurity Platform

See how the world’s most intelligent, autonomous cybersecurity platform can protect your organization today and into the future.